home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume13 / rpc3.9 / part10 < prev    next >
Encoding:
Internet Message Format  |  1988-02-27  |  60.2 KB

  1. Subject:  v13i087:  Sun RPC, release 3.9, Part10/15
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Stephen X. Nahm <sxn@Sun.COM>
  7. Posting-number: Volume 13, Issue 87
  8. Archive-name: rpc3.9/part10
  9.  
  10. #! /bin/sh
  11. # This is a shell archive. To extract, remove the header and type "sh filename"
  12. #
  13. echo x - man
  14. echo creating directory man
  15. mkdir man
  16. cd man
  17. echo x - man1
  18. echo creating directory man1
  19. mkdir man1
  20. cd man1
  21. echo x - rpcgen.1
  22. sed -e 's/^X//' > rpcgen.1 <<'Funky_Stuff'
  23. X.\" @(#)rpcgen.1    1.2 87/11/27 3.9 RPCSRC
  24. X.TH RPCGEN 1 "3 November 1987"
  25. X.SH NAME
  26. rpcgen \- an RPC protocol compiler
  27. X.SH SYNOPSIS
  28. \fBrpcgen\fP \fIinfile\fP
  29. X.br
  30. \fBrpcgen\fP \fB-h\fP \fB[-o \fIoutfile\fP]\fP \fB[\fIinputfile\fP]\fP
  31. X.br
  32. \fBrpcgen\fP \fB-c\fP \fB[-o \fIoutfile\fP]\fP \fB[\fIinfile\fP]\fP
  33. X.br
  34. \fBrpcgen\fP \fB-s\fP \fItransport\fP \fB[-o\fP \fIoutfile\fP]\fP \fB[\fIinfile\fP]\fP
  35. X.br
  36. \fBrpcgen\fP \fB-l\fP \fB[-o\fP \fIoutfile\fP]\fP \fB[\fIinfile\fP]\fP
  37. X.br
  38. \fBrpcgen\fP \fB-m\fP \fB[-o\fP \fIoutfile\fP]\fP \fB[\fIinfile\fP]\fP
  39. X.br
  40. X.SH DESCRIPTION
  41. X.IX "compilers" rpcgen "" "\fLrpcgen\fR \(em generate RPC protocols, C header files"
  42. X.IX rpcgen "" "\fLrpcgen\fR \(em generate RPC protocol, C header files, and server skeleton"
  43. X.IX RPC "generate protocols \(em \fLrpcgen\fR"
  44. \fIrpcgen\fP is a tool that generates
  45. X.B C
  46. code to implement an
  47. X.SM RPC
  48. protocol.  The input to \fIrpcgen\fP is a language similar
  49. X.B C 
  50. known as RPC Language (Remote Procedure Call Language).  Information
  51. about the syntax of RPC Language is available in the \fI`rpcgen' 
  52. Programming Guide\fP.
  53. X.LP
  54. X.I rpcgen 
  55. is normally used as in the first synopsis where it takes an input file
  56. and generates four output files. If the \fIinfile\fP is named \fIproto.x\fP,
  57. then \fIrpcgen\fP will generate a header file in \fIproto.h\fP, XDR
  58. routines in \fIproto_xdr.c\fP, server-side stubs in \fIproto_svc.c\fP
  59. and client-side stubs if \fIproto_clnt.c\fP.  
  60. X.LP
  61. The other synopses shown above are used when one does not want to 
  62. generate all the output files, but only a particular one.  Their
  63. usage is described in the \fBUSAGE\fP section below.
  64. X.LP
  65. The C-preprocessor, \fIcpp(1)\fP, is run on all input files before they are
  66. actually
  67. interpreted by \fIrpcgen\fP, so all the cpp directives are legal within
  68. an \fIrpcgen\fP input file.  For each type of output file, \fIrpcgen\fP defines
  69. a special cpp symbol for use by the \fIrpcgen\fP programmer:
  70. X.PP
  71. X.PD 0
  72. X.TP
  73. X.SM RPC_HDR
  74. defined when compiling into header files
  75. X.TP
  76. X.SM RPC_XDR
  77. defined when compiling into XDR routines
  78. X.TP
  79. X.SM RPC_SVC
  80. defined when compiling into server-side stubs
  81. X.TP
  82. X.SM RPC_CLNT
  83. defined when compiling into client-side stubs
  84. X.PD
  85. X.PP
  86. In addition, \fIrpcgen\fP does a little preprocessing of its own. Any line
  87. beginning with `%' is passed directly into the output file, uninterpreted
  88. by \fIrpcgen\fP.  
  89. X.LP
  90. You can customize some of your XDR routines by leaving those data
  91. types undefined.  For every data type that is undefined, \fIrpcgen\fP 
  92. will assume that there exists a routine with the name `xdr_' prepended
  93. to the name of the undefined type. 
  94. X.SH OPTIONS
  95. X.IP \fB-c\fP
  96. Compile into XDR routines.
  97. X.IP \fB-h\fP
  98. Compile into
  99. X.B C 
  100. data-definitions (a header file)
  101. X.IP "\fB-l\fP
  102. Compile into a client-side stubs.
  103. X.IP "\fB-s\fP \fItransport\fP"
  104. Compile into server-side stubs, using the the given transport.  The
  105. supported transports
  106. are \fBudp\fP and \fBtcp\fP. This option may be invoked more than once
  107. so as to compile a server that serves multiple transports.
  108. X.IP "\fB-m\fP
  109. Compile into a server-side stubs, but do not produce a \fImain()\fP routine.
  110. This option is useful if you want to supply your own \fImain()\fP.
  111. X.IP "\fB-o\fP \fIoutfile\fP"
  112. Specify the name of the output file.  If none is specified, standard
  113. output is used (\fB-c\fP, \fB-h\fP, \fB-l\fP and \fB-s\fP modes only).
  114. X.SH "SEE ALSO"
  115. \fI`rpcgen' Programming Guide\fP
  116. X.SH BUGS
  117. Nesting is not supported. As a work-around, structures can be declared at
  118. top-level, and their name used inside other structures in order to achieve 
  119. the same effect.
  120. X.LP
  121. Name clashes can occur when using program definitions, since the apparent
  122. scoping does not really apply. Most of these can be avoided by giving 
  123. unique names for programs, versions, procedures and types.
  124.  
  125. Funky_Stuff
  126. len=`wc -c < rpcgen.1`
  127. if [ $len !=     3769 ] ; then
  128.   echo error: rpcgen.1 was $len bytes long, should have been     3769
  129. fi
  130. cd ..
  131. echo done with directory man1
  132. echo x - man3
  133. echo creating directory man3
  134. mkdir man3
  135. cd man3
  136. echo x - bindresvport.3n
  137. sed -e 's/^X//' > bindresvport.3n <<'Funky_Stuff'
  138. X.\" @(#)bindresvport.3n    1.2 87/11/13 3.9 RPCSRC
  139. X.\" @(#)bindresvport.3n 1.2 87/10/06 SMI;
  140. X.TH BINDRESVPORT 3N  "6 October 1987"
  141. X.SH NAME
  142. bindresvport \- bind a socket to a privileged IP port
  143. X.SH SYNOPSIS
  144. X.nf
  145. X.B #include <sys/types.h>
  146. X.B #include <netinet/in.h>
  147. X.LP
  148. X.B bindresvport(sd, sin)
  149. X.B    int sd;
  150. X.B    struct sockaddr_in *sin;
  151. X.fi
  152. X.SH DESCRIPTION
  153. X.B bindresvport
  154. is used to bind a socket descriptor to a privileged
  155. X.SM IP
  156. port, that is, a
  157. port number in the range 0-1023.
  158. The routine returns 0 if it is successful,
  159. otherwise \-1 is returned and
  160. X.I errno
  161. set to reflect the cause of the error.
  162. X.LP
  163. Only root can bind to a privileged port; this call will fail for any
  164. other users.
  165. Funky_Stuff
  166. len=`wc -c < bindresvport.3n`
  167. if [ $len !=      681 ] ; then
  168.   echo error: bindresvport.3n was $len bytes long, should have been      681
  169. fi
  170. echo x - getrpcent.3n
  171. sed -e 's/^X//' > getrpcent.3n <<'Funky_Stuff'
  172. X.\" @(#)getrpcent.3n    1.2 87/11/13 3.9 RPCSRC
  173. X.\" @(#)getrpcent.3n 1.6 87/10/06 SMI;
  174. X.TH GETRPCENT 3N "6 October 1987"
  175. X.SH NAME
  176. getrpcent, getrpcbyname, getrpcbynumber \- get RPC entry
  177. X.SH SYNOPSIS
  178. X.nf
  179. X.ft B
  180. #include <netdb.h>
  181. X.LP
  182. X.ft B
  183. struct rpcent *getrpcent(\|)
  184. X.LP
  185. X.ft B
  186. struct rpcent *getrpcbyname(name)
  187. char *name;
  188. X.LP
  189. X.ft B
  190. struct rpcent *getrpcbynumber(number)
  191. int number;
  192. X.LP
  193. X.ft B
  194. setrpcent (stayopen)
  195. int stayopen
  196. X.LP
  197. X.ft B
  198. endrpcent (\|)
  199. X.fi
  200. X.IX  get "RPC program entry \(em \fLgetrpcent\fR"
  201. X.IX  set "RPC program entry \(em \fLsetrpcent\fR"
  202. X.IX  "RPC program entry, get \(em \fLgetrpcent\fR"
  203. X.IX  "getrpcent function"  ""  "\fLgetrpcent\fP \(em get RPC entry"
  204. X.IX  "getrpcbynumber function"  ""  "\fLgetrpcbynumber\fP \(em get RPC entry"
  205. X.IX  "getrpcbyname function"  ""  "\fLgetrpcbyname\fP \(em get RPC entry"
  206. X.IX  "setrpcent function"  ""  "\fLsetrpcent\fP \(em get RPC entry"
  207. X.IX  "endrpcent function"  ""  "\fLendrpcent\fP \(em get RPC entry"
  208. X.SH DESCRIPTION
  209. X.BR getrpcent ,
  210. X.BR getrpcbyname ,
  211. and
  212. X.B getrpcbynumber
  213. each return a pointer to an object with the
  214. following structure
  215. containing the broken-out
  216. fields of a line in the rpc program number data base,
  217. X.BR /etc/rpc .
  218. X.RS
  219. X.LP
  220. X.nf
  221. X.ft B
  222. struct    rpcent {
  223.     char    *r_name;    /* name of server for this rpc program */
  224.     char    **r_aliases;    /* alias list */
  225.     long    r_number;    /* rpc program number */
  226. };
  227. X.ft R
  228. X.fi
  229. X.RE
  230. X.LP
  231. The members of this structure are:
  232. X.RS
  233. X.PD 0
  234. X.TP 20
  235. X.B r_name
  236. The name of the server for this rpc program.
  237. X.TP 20
  238. X.B r_aliases
  239. A zero terminated list of alternate names for the rpc program.
  240. X.TP  20
  241. X.B r_number
  242. The rpc program number for this service.
  243. X.PD
  244. X.RE
  245. X.LP
  246. X.B getrpcent
  247. reads the next line of the file, opening the file if necessary.
  248. X.LP
  249. X.B getrpcent
  250. opens and rewinds the file.  If the
  251. X.I stayopen
  252. flag is non-zero,
  253. the net data base will not be closed after each call to
  254. X.B getrpcent
  255. (either directly, or indirectly through one of
  256. the other \*(lqgetrpc\*(rq calls).
  257. X.LP
  258. X.B endrpcent
  259. closes the file.
  260. X.LP
  261. X.B getrpcbyname
  262. and
  263. X.B getrpcbynumber
  264. sequentially search from the beginning
  265. of the file until a matching rpc program name or
  266. program number is found, or until
  267. X.SM EOF
  268. is encountered.
  269. X.SH FILES
  270. X.PD 0
  271. X.TP 20
  272. X.B /etc/rpc
  273. X.PD
  274. X.SH "SEE ALSO"
  275. X.BR rpc (5),
  276. X.BR rpcinfo (8),
  277. X.SH DIAGNOSTICS
  278. Null pointer
  279. X.BR  (0) 
  280. returned on EOF or error.
  281. X.SH BUGS
  282. All information
  283. is contained in a static area
  284. so it must be copied if it is
  285. to be saved.
  286. Funky_Stuff
  287. len=`wc -c < getrpcent.3n`
  288. if [ $len !=     2425 ] ; then
  289.   echo error: getrpcent.3n was $len bytes long, should have been     2425
  290. fi
  291. echo x - getrpcport.3r
  292. sed -e 's/^X//' > getrpcport.3r <<'Funky_Stuff'
  293. X.\" @(#)getrpcport.3r    1.2 87/11/13 3.9 RPCSRC
  294. X.\" @(#)getrpcport.3r 1.9 87/10/06 SMI;
  295. X.TH GETRPCPORT 3R "6 October 1987"
  296. X.SH NAME
  297. getrpcport \- get RPC port number
  298. X.SH SYNOPSIS
  299. X.ft B
  300. X.nf
  301. int getrpcport(host, prognum, versnum, proto)
  302.     char *host;
  303.     int prognum, versnum, proto;
  304. X.fi
  305. X.SH DESCRIPTION
  306. X.IX getrpcport "" "\fLgetrpcport\fR \(em get RPC port number"
  307. X.B getrpcport
  308. returns the port number for version
  309. X.I versnum
  310. of the RPC program
  311. X.I prognum
  312. running on
  313. X.I host
  314. and using protocol
  315. X.IR proto .
  316. It returns 0 if it cannot contact the portmapper, or if
  317. X.I prognum
  318. is not registered.  If
  319. X.I prognum
  320. is registered but not with version
  321. X.IR versnum ,
  322. it will still return a port number (for some version of the program)
  323. indicating that the program is indeed registered.
  324. The version mismatch will be detected upon the first call to the service.
  325. Funky_Stuff
  326. len=`wc -c < getrpcport.3r`
  327. if [ $len !=      842 ] ; then
  328.   echo error: getrpcport.3r was $len bytes long, should have been      842
  329. fi
  330. echo x - rpc.3n
  331. sed -e 's/^X//' > rpc.3n <<'Funky_Stuff'
  332. X.\" @(#)rpc.3n    1.2 87/11/24 3.9 RPCSRC
  333. X.TH RPC 3N "3 November 1987"
  334. X.SH NAME
  335. rpc \- library routines for remote procedure calls
  336. X.IX rpc "" "RPC routines"
  337. X.IX "remote procedure calls"
  338. X.IX rpc "" "RPC routines"
  339. X.IX "remote procedure calls"
  340. X.SH SYNOPSIS AND DESCRIPTION
  341. These routines allow C programs to make procedure
  342. calls on other machines across the network.
  343. First, the client calls a procedure to send a
  344. data packet to the server.
  345. Upon receipt of the packet, the server calls a dispatch routine
  346. to perform the requested service, and then sends back a
  347. reply.
  348. Finally, the procedure call returns to the client.
  349. X.LP
  350. X.ft B
  351. X.nf
  352. X.sp .5
  353. #include <rpc/rpc.h>
  354. X.fi
  355. X.ft R
  356. X.br
  357. X.if t .ne 8
  358. X.LP
  359. X.ft B
  360. X.nf
  361. X.sp .5
  362. void
  363. auth_destroy(auth)
  364. \s-1AUTH\s0 *auth;
  365. X.fi
  366. X.ft R
  367. X.IP
  368. A macro that destroys the authentication information associated with
  369. X.BR auth .
  370. Destruction usually involves deallocation of private data
  371. structures. The use of
  372. X.B auth
  373. is undefined after calling
  374. X.BR auth_destroy .
  375. X.br
  376. X.if t .ne 6
  377. X.LP
  378. X.ft B
  379. X.nf
  380. X.sp .5
  381. \s-1AUTH\s0 *
  382. authnone_create()
  383. X.fi
  384. X.ft R
  385. X.IP
  386. Creates and returns an
  387. X.SM RPC
  388. authentication handle that passes nonusable authentication
  389. information with each remote procedure call. This is the
  390. default authentication used by
  391. X.SM RPC.
  392. X.if t .ne 10
  393. X.LP
  394. X.ft B
  395. X.nf
  396. X.sp .5
  397. \s-1AUTH\s0 *
  398. authunix_create(host, uid, gid, len, aup_gids)
  399. char *host;
  400. int uid, gid, len, *aup.gids;
  401. X.fi
  402. X.ft R
  403. X.IP
  404. Creates and returns an
  405. X.SM RPC
  406. authentication handle that contains
  407. X.UX
  408. authentication information.
  409. The parameter
  410. X.B host
  411. is the name of the machine on which the information was
  412. created;
  413. X.B uid
  414. is the user's user
  415. X.SM ID ;
  416. X.B gid
  417. is the user's current group
  418. X.SM ID ;
  419. X.B len
  420. and
  421. X.B aup_gids
  422. refer to a counted array of groups to which the user belongs.
  423. It is easy to impersonate a user.
  424. X.br
  425. X.if t .ne 5
  426. X.LP
  427. X.ft B
  428. X.nf
  429. X.sp .5
  430. \s-1AUTH\s0 *
  431. authunix_create_default()
  432. X.fi
  433. X.ft R
  434. X.IP
  435. Calls
  436. X.B authunix_create
  437. with the appropriate parameters.
  438. X.br
  439. X.if t .ne 13
  440. X.LP
  441. X.ft B
  442. X.nf
  443. X.sp .5
  444. callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
  445. char *host;
  446. u_long prognum, versnum, procnum;
  447. char *in, *out;
  448. xdrproc_t inproc, outproc;
  449. X.fi
  450. X.ft R
  451. X.IP
  452. Calls the remote procedure associated with
  453. X.BR prognum ,
  454. X.BR versnum ,
  455. and
  456. X.B procnum
  457. on the machine,
  458. X.BR host .
  459. The parameter
  460. X.B in
  461. is the address of the procedure's argument(s), and
  462. X.B out
  463. is the address of where to place the result(s);
  464. X.B inproc
  465. is used to encode the procedure's parameters, and
  466. X.B outproc
  467. is used to decode the procedure's results.
  468. This routine returns zero if it succeeds, or the value of
  469. X.B "enum clnt_stat"
  470. cast to an integer if it fails.
  471. The routine
  472. X.B clnt_perrno
  473. is handy for translating failure statuses into messages.
  474. X.IP
  475. Warning: calling remote procedures with this routine
  476. uses
  477. X.SM UDP/IP
  478. as a transport; see
  479. X.B clntudp_create
  480. for restrictions.
  481. You do not have control of timeouts or authentication using
  482. this routine.
  483. X.br
  484. X.if t .ne 16
  485. X.LP
  486. X.ft B
  487. X.nf
  488. X.sp .5
  489. enum clnt_stat
  490. clnt_broadcast(prognum, versnum, procnum, inproc, in, outproc, out, eachresult)
  491. u_long prognum, versnum, procnum;
  492. char *in, *out;
  493. xdrproc_t inproc, outproc;
  494. resultproc_t eachresult;
  495. X.fi
  496. X.ft R
  497. X.IP
  498. Like
  499. X.BR callrpc ,
  500. except the call message is broadcast to all locally
  501. connected broadcast nets. Each time it receives a
  502. response, this routine calls
  503. X.BR eachresult ,
  504. whose form is:
  505. X.RS 1i
  506. X.ft B
  507. X.nf
  508. eachresult(out, addr)
  509. char *out;
  510. struct sockaddr_in *addr;
  511. X.ft R
  512. X.fi
  513. X.RE
  514. X.IP
  515. where
  516. X.B out
  517. is the same as
  518. X.B out
  519. passed to 
  520. X.BR clnt_broadcast ,
  521. except that the remote procedure's output is decoded there;
  522. X.B addr
  523. points to the address of the machine that sent the results.
  524. If
  525. X.B eachresult
  526. returns zero,
  527. X.B clnt_broadcast
  528. waits for more replies; otherwise it returns with appropriate
  529. status.
  530. X.IP
  531. Warning: broadcast sockets are limited in size to the
  532. maximum transfer unit of the data link. For ethernet,
  533. this value is 1500 bytes.
  534. X.br
  535. X.if t .ne 13
  536. X.LP
  537. X.ft B
  538. X.nf
  539. X.sp .5
  540. enum clnt_stat
  541. clnt_call(clnt, procnum, inproc, in, outproc, out, tout)
  542. \s-1CLIENT\s0 *clnt; u_long procnum;
  543. xdrproc_t inproc, outproc;
  544. char *in, *out;
  545. struct timeval tout;
  546. X.fi
  547. X.ft R
  548. X.IP
  549. A macro that calls the remote procedure
  550. X.B procnum
  551. associated with the client handle,
  552. X.BR clnt ,
  553. which is obtained with an
  554. X.SM RPC
  555. client creation routine such as
  556. X.BR clnt_create .
  557. The parameter
  558. X.B in
  559. is the address of the procedure's argument(s), and
  560. X.B out
  561. is the address of where to place the result(s);
  562. X.B inproc
  563. is used to encode the procedure's parameters, and
  564. X.B outproc
  565. is used to decode the procedure's results;
  566. X.B tout
  567. is the time allowed for results to come back.
  568. X.br
  569. X.if t .ne 7
  570. X.LP
  571. X.ft B
  572. X.nf
  573. X.sp .5
  574. clnt_destroy(clnt)
  575. \s-1CLIENT\s0 *clnt;
  576. X.fi
  577. X.ft R
  578. X.IP
  579. A macro that destroys the client's
  580. X.SM RPC
  581. handle. Destruction usually involves deallocation
  582. of private data structures, including
  583. X.B clnt
  584. itself.  Use of
  585. X.B clnt
  586. is undefined after calling
  587. X.BR clnt_destroy .
  588. If the
  589. X.SM RPC
  590. library opened the associated socket, it will close it also.
  591. Otherwise, the socket remains open.
  592. X.br
  593. X.if t .ne 10
  594. X.LP
  595. X.ft B
  596. X.nf
  597. X.sp .5
  598. \s-1CLIENT\s0 *
  599. clnt_create (host, prog, vers, proto)
  600. char *host;
  601. u_long prog, vers;
  602. char *proto;
  603. X.fi
  604. X.ft R
  605. X.IP
  606. Generic client creation routine.
  607. X.B host
  608. identifies the name of the remote host where the server
  609. is located.
  610. X.B proto
  611. indicates which kind of transport protocol to use. The
  612. currently supported values for this field are ``udp''
  613. and ``tcp''.
  614. Default timeouts are set, but can be modified using
  615. X.B clnt_control.
  616. X.IP
  617. Warning: Using
  618. X.SM UDP
  619. has its shortcomings.  Since
  620. X.SM UDP\s0-based
  621. X.SM RPC
  622. messages can only hold up to 8 Kbytes of encoded data,
  623. this transport cannot be used for procedures that take
  624. large arguments or return huge results.
  625. X.br
  626. X.if t .ne 10
  627. X.LP
  628. X.ft B
  629. X.nf
  630. X.sp .5
  631. bool_t
  632. clnt_control(cl, req, info)
  633. \s-1CLIENT\s0 *cl;
  634. char *info;
  635. X.fi
  636. X.ft R
  637. X.IP
  638. A macro used to change or retrieve various information
  639. about a client object.
  640. X.B req
  641. indicates the type of operation, and
  642. X.B info
  643. is a pointer to the information. For both
  644. X.SM UDP
  645. and
  646. X.SM TCP,
  647. the supported values of
  648. X.B req
  649. and their argument types and what they do are:
  650. X.nf
  651. X.ta +2.0i +2.0i +2.0i
  652. X.SM CLSET_TIMEOUT    struct timeval    set total timeout
  653. X.SM CLGET_TIMEOUT    struct timeval    get total timeout
  654. X.fi
  655. X.IP
  656. Note: if you set the timeout using
  657. X.BR clnt_control ,
  658. the timeout parameter passed to
  659. X.B clnt_call
  660. will be ignored in all future calls.
  661. X.nf
  662. X.SM CLGET_SERVER_ADDR    struct sockaddr    get server's address
  663. X.fi
  664. X.br
  665. The following operations are valid for
  666. X.SM UDP
  667. only:
  668. X.nf
  669. X.ta +2.0i ; +2.0i ; +2.0i
  670. X.SM CLSET_RETRY_TIMEOUT        struct timeval    set the retry timeout
  671. X.SM CLGET_RETRY_TIMEOUT        struct timeval    get the retry timeout
  672. X.fi
  673. X.br
  674. The retry timeout is the time that
  675. X.SM "UDP RPC"
  676. waits for the server to reply before
  677. retransmitting the request.
  678. X.br
  679. X.if t .ne 10
  680. X.LP
  681. X.ft B
  682. X.nf
  683. X.sp .5
  684. clnt_freeres(clnt, outproc, out)
  685. \s-1CLIENT\s0 *clnt;
  686. xdrproc_t outproc;
  687. char *out;
  688. X.fi
  689. X.ft R
  690. X.IP
  691. A macro that frees any data allocated by the
  692. X.SM RPC/XDR
  693. system when it decoded the results of an
  694. X.SM RPC
  695. call.  The
  696. parameter
  697. X.B out   
  698. is the address of the results, and
  699. X.B outproc
  700. is the
  701. X.SM XDR
  702. routine describing the results in simple primitives.
  703. This routine returns one if the results were successfully
  704. freed,
  705. and zero otherwise.
  706. X.br
  707. X.if t .ne 6
  708. X.LP
  709. X.ft B
  710. X.nf
  711. X.sp .5
  712. void
  713. clnt_geterr(clnt, errp)
  714. \s-1CLIENT\s0 *clnt;
  715. struct rpc_err *errp;
  716. X.fi
  717. X.ft R
  718. X.IP
  719. A macro that copies the error structure out of the client
  720. handle
  721. to the structure at address
  722. X.BR errp .
  723. X.br
  724. X.if t .ne 8
  725. X.LP
  726. X.ft B
  727. X.nf
  728. X.sp .5
  729. void
  730. clnt_pcreateerror(s)
  731. char *s;
  732. X.fi
  733. X.ft R
  734. X.IP
  735. Prints a message to standard error indicating
  736. why a client
  737. X.SM RPC
  738. handle could not be created.
  739. The message is prepended with string
  740. X.B s
  741. and a colon.
  742. Used when a
  743. X.BR clnt_create ,
  744. X.BR clntraw_create ,
  745. X.BR clnttcp_create ,
  746. or
  747. X.B clntudp_create
  748. call fails.
  749. X.br
  750. X.if t .ne 8
  751. X.LP
  752. X.ft B
  753. X.nf
  754. X.sp .5
  755. void
  756. clnt_perrno(stat)
  757. enum clnt_stat stat;
  758. X.fi
  759. X.ft R
  760. X.IP
  761. Prints a message to standard error corresponding
  762. to the condition indicated by
  763. X.BR stat .
  764. Used after
  765. X.BR callrpc .
  766. X.br
  767. X.if t .ne 8
  768. X.LP
  769. X.ft B
  770. X.nf
  771. X.sp .5
  772. clnt_perror(clnt, s)
  773. \s-1CLIENT\s0 *clnt;
  774. char *s;
  775. X.fi
  776. X.ft R
  777. X.IP
  778. Prints a message to standard error indicating why an
  779. X.SM RPC
  780. call failed;
  781. X.B clnt
  782. is the handle used to do the call.
  783. The message is prepended with string
  784. X.B s
  785. and a colon.
  786. Used after
  787. X.BR clnt_call .
  788. X.br
  789. X.if t .ne 9
  790. X.LP
  791. X.ft B
  792. X.nf
  793. X.sp .5
  794. char *
  795. clnt_spcreateerror
  796. char *s;
  797. X.fi
  798. X.ft R
  799. X.IP
  800. Like
  801. X.BR clnt_pcreateerror ,
  802. except that it returns a string
  803. instead of printing to the standard error.
  804. X.IP
  805. Bugs: returns pointer to static data that is overwritten
  806. on each call.
  807. X.br
  808. X.if t .ne 9
  809. X.LP
  810. X.ft B
  811. X.nf
  812. X.sp .5
  813. char *
  814. clnt_sperrno(stat)
  815. enum clnt_stat stat;
  816. X.fi
  817. X.ft R
  818. X.IP
  819. Takes the same arguments as
  820. X.BR clnt_perrno ,
  821. but instread of sending a message to the standard error
  822. indicating why an
  823. X.SM RPC
  824. call failed, it returns a pointer to a string which contains
  825. the
  826. message.  The string ends with a newline.
  827. X.IP
  828. X.B clnt_sperrno
  829. is used instead of
  830. X.B clnt_perrno
  831. if the program doesn't have a standard error (as a program
  832. running as a server quite likely doesn't), or if the
  833. programmer
  834. doesn't want the message to be output with
  835. X.BR printf ,
  836. or if a message format different than that supported by
  837. X.B clnt_perrno   
  838. is to be used.
  839. Note: unlike
  840. X.B clnt_sperror
  841. and
  842. X.BR clnt_spcreaterror ,
  843. X.B clnt_sperrno
  844. does not return pointer to static data so the
  845. result will not get overwritten on each call.
  846. X.br
  847. X.if t .ne 7
  848. X.LP
  849. X.ft B
  850. X.nf
  851. X.sp .5
  852. char *
  853. clnt_sperror(rpch, s)
  854. \s-1CLIENT\s0 *rpch;
  855. char *s;
  856. X.fi
  857. X.ft R
  858. X.IP
  859. Like
  860. X.BR clnt_perror ,
  861. except that (like
  862. X.BR clnt_sperrno )
  863. it returns a string instead of printing to standard error.
  864. X.IP
  865. Bugs: returns pointer to static data that is overwritten
  866. on each call.
  867. X.br
  868. X.if t .ne 10
  869. X.LP
  870. X.ft B
  871. X.nf
  872. X.sp .5
  873. \s-1CLIENT\s0 *
  874. clntraw_create(prognum, versnum)
  875. u_long prognum, versnum;
  876. X.fi
  877. X.ft R
  878. X.IP
  879. This routine creates a toy
  880. X.SM RPC
  881. client for the remote program
  882. X.BR prognum ,
  883. version
  884. X.BR versnum .
  885. The transport used to pass messages to the service is
  886. actually a buffer within the process's address space, so the
  887. corresponding
  888. X.SM RPC
  889. server should live in the same address space; see
  890. X.BR svcraw_create .
  891. This allows simulation of
  892. X.SM RPC
  893. and acquisition of
  894. X.SM RPC
  895. overheads, such as round trip times, without any
  896. kernel interference. This routine returns
  897. X.SM NULL
  898. if it fails.
  899. X.br
  900. X.if t .ne 15
  901. X.LP
  902. X.ft B
  903. X.nf
  904. X.sp .5
  905. \s-1CLIENT\s0 *
  906. clnttcp_create(addr, prognum, versnum, sockp, sendsz, recvsz)
  907. struct sockaddr_in *addr;
  908. u_long prognum, versnum;
  909. int *sockp;
  910. u_int sendsz, recvsz;
  911. X.fi
  912. X.ft R
  913. X.IP
  914. This routine creates an
  915. X.SM RPC
  916. client for the remote program
  917. X.BR prognum ,
  918. version
  919. X.BR versnum ;
  920. the client uses
  921. X.SM TCP/IP
  922. as a transport. The remote program is located at Internet
  923. address
  924. X.BR *addr .
  925. If
  926. X.B addr->sin_port
  927. is zero, then it is set to the actual port that the remote
  928. program is listening on (the remote
  929. X.B portmap
  930. service is consulted for this information). The parameter
  931. X.B sockp 
  932. is a socket; if it is
  933. X.BR \s-1RPC_ANYSOCK\s0 ,
  934. then this routine opens a new one and sets
  935. X.BR sockp .
  936. Since
  937. X.SM TCP\s0-based
  938. X.SM RPC
  939. uses buffered
  940. X.SM I/O ,
  941. the user may specify the size of the send and receive buffers
  942. with the parameters
  943. X.B sendsz
  944. and
  945. X.BR recvsz ;
  946. values of zero choose suitable defaults.
  947. This routine returns
  948. X.SM NULL
  949. if it fails.
  950. X.br
  951. X.if t .ne 15
  952. X.LP
  953. X.ft B
  954. X.nf
  955. X.sp .5
  956. \s-1CLIENT\s0 *
  957. clntudp_create(addr, pronum, versnum, wait, sockp)
  958. struct sockaddr_in *addr;
  959. u_long prognum, versnum;
  960. struct timeval wait;
  961. int *sockp;
  962. X.fi
  963. X.ft R
  964. X.IP
  965. This routine creates an
  966. X.SM RPC
  967. client for the remote program
  968. X.BR prognum ,
  969. version
  970. X.BR versnum ;
  971. the client uses use
  972. X.SM UDP/IP
  973. as a transport. The remote program is located at Internet
  974. address
  975. X.BR addr .
  976. If
  977. X.B addr->sin_port
  978. is zero, then it is set to actual port that the remote
  979. program is listening on (the remote
  980. X.B portmap
  981. service is consulted for this information). The parameter
  982. X.B sockp 
  983. is a socket; if it is
  984. X.B
  985. X.SM RPC_ANYSOCK
  986. , then this routine opens a new one and sets
  987. X.BR sockp .
  988. The
  989. X.SM UDP
  990. transport resends the call message in intervals of
  991. X.B wait
  992. time until a response is received or until the call times
  993. out.
  994. The total time for the call to time out is specified by
  995. X.BR clnt_call .
  996. X.IP
  997. Warning: since
  998. X.SM UDP\s0-based
  999. X.SM RPC
  1000. messages can only hold up to 8 Kbytes
  1001. of encoded data, this transport cannot be used for procedures
  1002. that take large arguments or return huge results.
  1003. X.br
  1004. X.if t .ne 7
  1005. X.LP
  1006. X.ft B
  1007. X.nf
  1008. X.sp .5
  1009. void
  1010. get_myaddress(addr)
  1011. struct sockaddr_in *addr;
  1012. X.fi
  1013. X.ft R
  1014. X.IP
  1015. Stuffs the machine's
  1016. X.SM IP  
  1017. address into
  1018. X.BR *addr ,
  1019. without consulting the library routines that deal with
  1020. X.br
  1021. X.BR /etc/hosts .
  1022. The port number is always set to
  1023. X.BR htons (
  1024. X.SM PMAPPORT
  1025. ).
  1026. X.br
  1027. X.if t .ne 10
  1028. X.LP
  1029. X.ft B
  1030. X.nf
  1031. X.sp .5
  1032. struct pmaplist *
  1033. pmap_getmaps(addr)
  1034. struct sockaddr_in *addr;
  1035. X.fi
  1036. X.ft R
  1037. X.IP
  1038. A user interface to the
  1039. X.B portmap
  1040. service, which returns a list of the current
  1041. X.SM RPC
  1042. program-to-port mappings
  1043. on the host located at
  1044. X.SM IP
  1045. address
  1046. X.BR *addr .
  1047. This routine can return
  1048. X.SM NULL .
  1049. The command
  1050. X.B "rpcinfo -p"
  1051. uses this routine.
  1052. X.br
  1053. X.if t .ne 12
  1054. X.LP
  1055. X.ft B
  1056. X.nf
  1057. X.sp .5
  1058. u_short
  1059. pmap_getport(addr, prognum, versnum, protocol)
  1060. struct sockaddr_in *addr;
  1061. u_long prognum, versnum, protocol;
  1062. X.fi
  1063. X.ft R
  1064. X.IP
  1065. A user interface to the
  1066. X.B portmap
  1067. service, which returns the port number
  1068. on which waits a service that supports program number
  1069. X.BR prognum ,
  1070. version
  1071. X.BR versnum ,
  1072. and speaks the transport protocol associated with
  1073. X.BR protocol .
  1074. The value of
  1075. X.B protocol
  1076. is most likely
  1077. X.B
  1078. X.SM IPPROTO_UDP
  1079. or 
  1080. X.BR \s-1IPPROTO_TCP\s0 .
  1081. A return value of zero means that the mapping does not exist
  1082. or that
  1083. the
  1084. X.SM RPC
  1085. system failured to contact the remote
  1086. X.B portmap
  1087. service.  In the latter case, the global variable
  1088. X.B rpc_createerr
  1089. contains the
  1090. X.SM RPC
  1091. status.
  1092. X.br
  1093. X.if t .ne 15
  1094. X.LP
  1095. X.ft B
  1096. X.nf
  1097. X.sp .5
  1098. enum clnt_stat
  1099. pmap_rmtcall(addr, prognum, versnum, procnum, inproc, in, outproc, out, tout, portp)
  1100. struct sockaddr_in *addr;
  1101. u_long prognum, versnum, procnum;
  1102. char *in, *out;
  1103. xdrproc_t inproc, outproc;
  1104. struct timeval tout;
  1105. u_long *portp;
  1106. X.fi
  1107. X.ft R
  1108. X.IP
  1109. A user interface to the
  1110. X.B portmap
  1111. service, which instructs
  1112. X.B portmap
  1113. on the host at
  1114. X.SM IP
  1115. address
  1116. X.B *addr
  1117. to make an RPC call on your behalf to a procedure on that
  1118. host.
  1119. The parameter
  1120. X.B *portp
  1121. will be modified to the program's port number if the
  1122. procedure
  1123. succeeds. The definitions of other parameters are discussed
  1124. in
  1125. X.B callrpc
  1126. and
  1127. X.BR clnt_call .
  1128. This procedure should be used for a ``ping'' and nothing
  1129. else.
  1130. See also
  1131. X.BR clnt_broadcast .
  1132. X.br
  1133. X.if t .ne 9
  1134. X.LP
  1135. X.ft B
  1136. X.nf
  1137. X.sp .5
  1138. pmap_set(prognum, versnum, protocol, port)
  1139. u_long prognum, versnum, protocol;
  1140. u_short port;
  1141. X.fi
  1142. X.ft R
  1143. X.IP
  1144. A user interface to the
  1145. X.B portmap
  1146. service, which establishes a mapping between the triple
  1147. X.RB [ prognum,versnum,protocol ]
  1148. and
  1149. X.B port
  1150. on the machine's
  1151. X.B portmap
  1152. service. The value of
  1153. X.B protocol
  1154. is most likely
  1155. X.B
  1156. X.SM IPPROTO_UDP
  1157. or 
  1158. X.BR \s-1IPPROTO_TCP\s0 .
  1159. This routine returns one if it succeeds, zero otherwise.
  1160. Automatically done by
  1161. X.BR svc_register .
  1162. X.br
  1163. X.if t .ne 7
  1164. X.LP
  1165. X.ft B
  1166. X.nf
  1167. X.sp .5
  1168. pmap_unset(prognum, versnum)
  1169. u_long prognum, versnum;
  1170. X.fi
  1171. X.ft R
  1172. X.IP
  1173. A user interface to the
  1174. X.B portmap
  1175. service, which destroys all mapping between the triple
  1176. X.RB [ "prognum, versnum, *" ]
  1177. and 
  1178. X.B ports
  1179. on the machine's
  1180. X.B portmap
  1181. service. This routine returns one if it succeeds, zero
  1182. otherwise.
  1183. X.br
  1184. X.if t .ne 15
  1185. X.LP
  1186. X.ft B
  1187. X.nf
  1188. X.sp .5
  1189. registerrpc(prognum, versnum, procnum, procname, inproc, outproc)
  1190. u_long prognum, versnum, procnum;
  1191. char *(*procname) () ;
  1192. xdrproc_t inproc, outproc;
  1193. X.fi
  1194. X.ft R
  1195. X.IP
  1196. Registers procedure
  1197. X.B procname
  1198. with the
  1199. X.SM RPC
  1200. service package.  If a request arrives for program
  1201. X.BR prognum ,
  1202. version
  1203. X.BR versnum ,
  1204. and procedure
  1205. X.BR procnum ,
  1206. X.B procname
  1207. is called with a pointer to its parameter(s);
  1208. X.B progname
  1209. should return a pointer to its static result(s);
  1210. X.B inproc
  1211. is used to decode the parameters while
  1212. X.B outproc
  1213. is used to encode the results.
  1214. This routine returns zero if the registration succeeded, \-1
  1215. otherwise.
  1216. X.IP
  1217. Warning: remote procedures registered in this form
  1218. are accessed using the
  1219. X.SM UDP/IP
  1220. transport; see
  1221. X.B svcudp_create
  1222. for restrictions.
  1223. X.br
  1224. X.if t .ne 5
  1225. X.LP
  1226. X.ft B
  1227. X.nf
  1228. X.sp .5
  1229. struct rpc_createerr     rpc_createerr;
  1230. X.fi
  1231. X.ft R
  1232. X.IP
  1233. A global variable whose value is set by any
  1234. X.SM RPC
  1235. client creation routine
  1236. that does not succeed.  Use the routine
  1237. X.B clnt_pcreateerror
  1238. to print the reason why.
  1239. X.if t .ne 7
  1240. X.LP
  1241. X.ft B
  1242. X.nf
  1243. X.sp .5
  1244. svc_destroy(xprt)
  1245. \s-1SVCXPRT\s0 * xprt;
  1246. X.fi
  1247. X.ft R
  1248. X.IP
  1249. A macro that destroys the
  1250. X.SM RPC
  1251. service transport handle,
  1252. X.BR xprt .
  1253. Destruction usually involves deallocation
  1254. of private data structures, including
  1255. X.B xprt
  1256. itself.  Use of
  1257. X.B xprt
  1258. is undefined after calling this routine.
  1259. X.br
  1260. X.if t .ne 8
  1261. X.LP
  1262. X.ft B
  1263. X.nf
  1264. X.sp .5
  1265. fd_set svc_fdset;
  1266. X.fi
  1267. X.ft R
  1268. X.IP
  1269. A global variable reflecting the
  1270. X.SM RPC
  1271. service side's
  1272. read file descriptor bit mask; it is suitable as a parameter
  1273. to the
  1274. X.B select
  1275. system call. This is only of interest
  1276. if a service implementor does not call
  1277. X.BR svc_run ,
  1278. but rather does his own asynchronous event processing.
  1279. This variable is read-only (do not pass its address to
  1280. X.BR select !),
  1281. yet it may change after calls to
  1282. X.B svc_getreqset
  1283. or any creation routines.
  1284. X.br
  1285. X.if t .ne 6
  1286. X.LP
  1287. X.ft B
  1288. X.nf
  1289. X.sp .5
  1290. int svc_fds;
  1291. X.fi
  1292. X.ft R
  1293. X.IP
  1294. Similar to
  1295. X.BR svc_fedset ,
  1296. but limited to 32 descriptors. This
  1297. interface is obsoleted by
  1298. X.BR svc_fdset .
  1299. X.br
  1300. X.if t .ne 9
  1301. X.LP
  1302. X.ft B
  1303. X.nf
  1304. X.sp .5
  1305. svc_freeargs(xprt, inproc, in)
  1306. \s-1SVCXPRT\s0 *xprt;
  1307. xdrproc_t inproc;
  1308. char *in;
  1309. X.fi
  1310. X.ft R
  1311. X.IP
  1312. A macro that frees any data allocated by the
  1313. X.SM RPC/XDR
  1314. system when it decoded the arguments to a service procedure
  1315. using
  1316. X.BR svc_getargs .
  1317. This routine returns one if the results were successfully
  1318. freed,
  1319. and zero otherwise.
  1320. X.br
  1321. X.if t .ne 10
  1322. X.LP
  1323. X.ft B
  1324. X.nf
  1325. X.sp .5
  1326. svc_getargs(xprt, inproc, in)
  1327. \s-1SVCXPRT\s0 *xprt;
  1328. xdrproc_t inproc;
  1329. char *in;
  1330. X.fi
  1331. X.ft R
  1332. X.IP
  1333. A macro that decodes the arguments of an
  1334. X.SM RPC
  1335. request
  1336. associated with the
  1337. X.SM RPC
  1338. service transport handle,
  1339. X.B xprt .
  1340. The parameter
  1341. X.B in
  1342. is the address where the arguments will be placed;
  1343. X.B inproc
  1344. is the
  1345. X.SM XDR
  1346. routine used to decode the arguments.
  1347. This routine returns one if decoding succeeds, and zero
  1348. otherwise.
  1349. X.br
  1350. X.if t .ne 9
  1351. X.LP
  1352. X.ft B
  1353. X.nf
  1354. X.sp .5
  1355. struct sockaddr_in
  1356. svc_getcaller(xprt)
  1357. \s-1SVCXPRT\s0 *xprt;
  1358. X.fi
  1359. X.ft R
  1360. X.IP
  1361. The approved way of getting the network address of the caller
  1362. of a procedure associated with the
  1363. X.SM RPC
  1364. service transport handle,
  1365. X.BR xprt .
  1366. X.br
  1367. X.if t .ne 9
  1368. X.LP
  1369. X.ft B
  1370. X.nf
  1371. X.sp .5
  1372. svc_getreqset(rdfds)
  1373. fd_set *rdfds;
  1374. X.fi
  1375. X.ft R
  1376. X.IP
  1377. This routine is only of interest if a service implementor
  1378. does not call
  1379. X.BR svc_run ,
  1380. but instead implements custom asynchronous event processing.
  1381. It is called when the
  1382. X.B select
  1383. system call has determined that an
  1384. X.SM RPC
  1385. request has arrived on some
  1386. X.SM RPC
  1387. socket(s);
  1388. X.B rdfds
  1389. is the resultant read file descriptor bit mask.
  1390. The routine returns when all sockets associated with the
  1391. value of
  1392. X.B rdfds
  1393. have been serviced.
  1394. X.br
  1395. X.if t .ne 6
  1396. X.LP
  1397. X.ft B
  1398. X.nf
  1399. X.sp .5
  1400. svc_getreq(rdfds)
  1401. int rdfds;
  1402. X.fi
  1403. X.ft R
  1404. X.IP
  1405. Similar to 
  1406. X.BR svc_getreqset ,
  1407. but limited to 32 descriptors. This interface is obsoleted by
  1408. X.BR svc_getreqset .
  1409. X.br
  1410. X.if t .ne 17
  1411. X.LP
  1412. X.ft B
  1413. X.nf
  1414. X.sp .5
  1415. svc_register(xprt, prognum, versnum, dispatch, protocol)
  1416. \s-1SVCXPRT\s0 *xprt;
  1417. u_long prognum, versnum;
  1418. void (*dispatch) ();
  1419. u_long protocol;
  1420. X.fi
  1421. X.ft R
  1422. X.IP
  1423. Associates
  1424. X.B prognum
  1425. and
  1426. X.B versnum
  1427. with the service dispatch procedure,
  1428. X.BR dispatch .
  1429. If
  1430. X.B protocol
  1431. is zero, the service is not registered with the
  1432. X.B portmap
  1433. service.  If
  1434. X.B protocol
  1435. is non-zero, then a mapping of the triple
  1436. X.RB [ "prognum, versnum, protocol" ]
  1437. to
  1438. X.B xprt->xp_port
  1439. is established with the local
  1440. X.B portmap
  1441. service (generally
  1442. X.B protocol
  1443. is zero,
  1444. X.B
  1445. X.SM IPPROTO_UDP
  1446. or 
  1447. X.B
  1448. X.SM IPPROTO_TCP
  1449. ).
  1450. The procedure
  1451. X.B dispatch
  1452. has the following form:
  1453. X.RS 1i
  1454. X.ft B
  1455. X.nf 
  1456. dispatch(request, xprt)
  1457. struct svc_req *request;
  1458. \s-1SVCXPRT\s0 *xprt;
  1459. X.ft R
  1460. X.fi
  1461. X.RE
  1462. X.IP
  1463. The
  1464. X.B svc_register
  1465. routine returns one if it succeeds, and zero otherwise.
  1466. X.br
  1467. X.if t .ne 6
  1468. X.LP
  1469. X.ft B
  1470. X.nf
  1471. X.sp .5
  1472. svc_run()
  1473. X.fi
  1474. X.ft R
  1475. X.IP
  1476. This routine never returns. It waits for 
  1477. X.SM RPC 
  1478. requests to arrive, and calls the appropriate service
  1479. procedure using
  1480. X.B svc_getreq
  1481. when one arrives. This procedure is usually waiting for a
  1482. X.B select
  1483. system call to return.
  1484. X.br
  1485. X.if t .ne 9
  1486. X.LP
  1487. X.ft B
  1488. X.nf
  1489. X.sp .5
  1490. svc_sendreply(xprt, outproc, out)
  1491. \s-1SVCXPRT\s0 *xprt;
  1492. xdrproc_t outproc;
  1493. char *out;
  1494. X.fi
  1495. X.ft R
  1496. X.IP
  1497. Called by an
  1498. X.SM RPC
  1499. service's dispatch routine to send the results of a
  1500. remote procedure call.  The parameter
  1501. X.B xprt  
  1502. is the request's associated transport handle;
  1503. X.B outproc
  1504. is the
  1505. X.SM XDR
  1506. routine which is used to encode the results; and
  1507. X.B out
  1508. is the address of the results.
  1509. This routine returns one if it succeeds, zero otherwise.
  1510. X.br
  1511. X.if t .ne 7
  1512. X.LP
  1513. X.ft B
  1514. X.nf
  1515. X.sp .5
  1516. void
  1517. svc_unregister(prognum, versnum)
  1518. u_long prognum, versnum;
  1519. X.fi
  1520. X.ft R
  1521. X.IP
  1522. Removes all mapping of the double
  1523. X.RB [ "prognum, versnum" ]
  1524. to dispatch routines, and of the triple
  1525. X.RB [ "prognum, versnum, *" ]
  1526. to port number.
  1527. X.br
  1528. X.if t .ne 9
  1529. X.LP
  1530. X.ft B
  1531. X.nf
  1532. X.sp .5
  1533. void
  1534. svcerr_auth(xprt, why)
  1535. \s-1SVCXPRT\s0 *xprt;
  1536. enum auth_stat why;
  1537. X.fi
  1538. X.ft R
  1539. X.IP
  1540. Called by a service dispatch routine that refuses to perform
  1541. a remote procedure call due to an authentication error.
  1542. X.br
  1543. X.if t .ne 7
  1544. X.LP
  1545. X.ft B
  1546. X.nf
  1547. X.sp .5
  1548. void
  1549. svcerr_decode(xprt)
  1550. \s-1SVCXPRT\s0 *xprt;
  1551. X.fi
  1552. X.ft R
  1553. X.IP
  1554. Called by a service dispatch routine that can't successfully
  1555. decode its parameters. See also
  1556. X.BR svc_getargs .
  1557. X.br
  1558. X.if t .ne 7
  1559. X.LP
  1560. X.ft B
  1561. X.nf
  1562. X.sp .5
  1563. void
  1564. svcerr_noproc(xprt)
  1565. \s-1SVCXPRT\s0 *xprt;
  1566. X.fi
  1567. X.ft R
  1568. X.IP
  1569. Called by a service dispatch routine that doesn't implement
  1570. the procedure number that the caller requests.
  1571. X.br
  1572. X.if t .ne 7
  1573. X.LP
  1574. X.ft B
  1575. X.nf
  1576. X.sp .5
  1577. void
  1578. svcerr_noprog(xprt)
  1579. \s-1SVCXPRT\s0 *xprt;
  1580. X.fi
  1581. X.ft R
  1582. X.IP
  1583. Called when the desired program is not registered with the
  1584. X.SM RPC 
  1585. package. Service implementors usually don't need this routine.
  1586. X.br
  1587. X.if t .ne 7
  1588. X.LP
  1589. X.ft B
  1590. X.nf
  1591. X.sp .5
  1592. void
  1593. svcerr_progvers(xprt)
  1594. \s-1SVCXPRT\s0 *xprt;
  1595. X.fi
  1596. X.ft R
  1597. X.IP
  1598. Called when the desired version of a program is not registered 
  1599. with the
  1600. X.SM RPC
  1601. package. Service implementors usually don't need this routine.
  1602. X.br
  1603. X.if t .ne 7
  1604. X.LP
  1605. X.ft B
  1606. X.nf
  1607. X.sp .5
  1608. void
  1609. svcerr_systemerr(xprt)
  1610. \s-1SVCXPRT\s0 *xprt;
  1611. X.fi
  1612. X.ft R
  1613. X.IP
  1614. Called by a service dispatch routine when it detects a system
  1615. error
  1616. not covered by any particular protocol.
  1617. For example, if a service can no longer allocate storage,
  1618. it may call this routine.
  1619. X.br
  1620. X.if t .ne 8
  1621. X.LP
  1622. X.ft B
  1623. X.nf
  1624. X.sp .5
  1625. void
  1626. svcerr_weakauth(xprt)
  1627. \s-1SVCXPRT\s0 *xprt;
  1628. X.fi
  1629. X.ft R
  1630. X.IP
  1631. Called by a service dispatch routine that refuses to perform
  1632. a remote procedure call due to insufficient (but correct)
  1633. authentication parameters.  The routine calls
  1634. X.B "svcerr_auth(xprt, "
  1635. X.B
  1636. X.SM AUTH_TOOWEAK
  1637. ) .
  1638. X.br
  1639. X.if t .ne 11
  1640. X.LP
  1641. X.ft B
  1642. X.nf
  1643. X.sp .5
  1644. \s-1SVCXPRT\s0 *
  1645. svcraw_create()
  1646. X.fi
  1647. X.ft R
  1648. X.IP
  1649. This routine creates a toy
  1650. X.SM RPC
  1651. service transport, to which it returns a pointer.  The
  1652. transport
  1653. is really a buffer within the process's address space, 
  1654. so the corresponding 
  1655. X.SM RPC 
  1656. client should live in the same 
  1657. address space; 
  1658. see 
  1659. X.BR clntraw_create . 
  1660. This routine allows simulation of 
  1661. X.SM RPC 
  1662. and acquisition of 
  1663. X.SM RPC 
  1664. overheads (such as round trip times), without any kernel 
  1665. interference. 
  1666. This routine returns 
  1667. X.SM NULL 
  1668. if it fails. 
  1669. X.br
  1670. X.if t .ne 11
  1671. X.LP
  1672. X.ft B
  1673. X.nf
  1674. X.sp .5
  1675. \s-1SVCXPRT\s0 *
  1676. svctcp_create(sock, send_buf_size, recv_buf_size)
  1677. int sock;
  1678. u_int send_buf_size, recv_buf_size;
  1679. X.fi
  1680. X.ft R
  1681. X.IP
  1682. This routine creates a
  1683. X.SM TCP/IP\s0-based
  1684. X.SM RPC
  1685. service transport, to which it returns a pointer.
  1686. The transport is associated with the socket
  1687. X.BR sock ,
  1688. which may be
  1689. X.B
  1690. X.SM RPC_ANYSOCK ,
  1691. in which case a new socket is created.
  1692. If the socket is not bound to a local
  1693. X.SM TCP
  1694. port, then this routine binds it to an arbitrary port. Upon
  1695. completion,
  1696. X.B xprt->xp_sock
  1697. is the transport's socket number, and
  1698. X.B xprt->xp_port
  1699. is the transport's port number.
  1700. This routine returns
  1701. X.SM NULL
  1702. if it fails. Since
  1703. X.SM TCP\s0-based
  1704. X.SM RPC
  1705. uses buffered
  1706. X.SM I/O ,
  1707. users may specify the size of buffers; values of zero
  1708. choose suitable defaults.
  1709. X.br
  1710. X.if t .ne 11
  1711. X.LP
  1712. X.ft B
  1713. X.nf
  1714. X.sp .5
  1715. void
  1716. svcfd_create(fd, sensize, recvsize)
  1717. int fd;
  1718. u_int sendsize;
  1719. u_int recvsize;
  1720. X.fi
  1721. X.ft R
  1722. X.IP
  1723. Creates a service on top of any open desciptor. Typically,
  1724. this
  1725. descriptor is a connected socket for a stream protocol such
  1726. as
  1727. X.SM TCP .
  1728. X.B sendsize
  1729. and
  1730. X.B recvsize
  1731. indicate sizes for the send and receive buffers.  If they are
  1732. zero, a reasonable default is chosen.
  1733. X.br
  1734. X.if t .ne 10
  1735. X.LP
  1736. X.ft B
  1737. X.nf
  1738. X.sp .5
  1739. \s-1SVCXPRT\s0 *
  1740. svcudp_create(sock)
  1741. int sock;
  1742. X.fi
  1743. X.ft R
  1744. X.IP
  1745. This routine creates a
  1746. X.SM UDP/IP\s0-based
  1747. X.SM RPC
  1748. service transport, to which it returns a pointer.
  1749. The transport is associated with the socket
  1750. X.BR sock ,
  1751. which may be
  1752. X.B \s-1RPC_ANYSOCK\s0 ,
  1753. in which case a new socket is created.
  1754. If the socket is not bound to a local
  1755. X.SM UDP
  1756. port, then this routine binds it to an arbitrary port. Upon
  1757. completion,
  1758. X.B xprt->xp_sock
  1759. is the transport's socket number, and
  1760. X.B xprt->xp_port
  1761. is the transport's port number.
  1762. This routine returns
  1763. X.SM NULL
  1764. if it fails.
  1765. X.IP
  1766. Warning: since
  1767. X.SM UDP\s0-based
  1768. X.SM RPC
  1769. messages can only hold up to 8 Kbytes
  1770. of encoded data, this transport cannot be used for procedures
  1771. that take large arguments or return huge results.
  1772. X.br
  1773. X.if t .ne 7
  1774. X.LP
  1775. X.ft B
  1776. X.nf
  1777. X.sp .5
  1778. xdr_accepted_reply(xdrs, ar)
  1779. \s-1XDR\s0 *xdrs;
  1780. struct accepted_reply *ar;
  1781. X.fi
  1782. X.ft R
  1783. X.IP
  1784. Used for describing
  1785. X.SM RPC
  1786. messages, externally. This routine is useful for users who
  1787. wish
  1788. to generate
  1789. \s-1RPC\s0-style
  1790. messages without using the
  1791. X.SM RPC
  1792. package.
  1793. X.br
  1794. X.if t .ne 7
  1795. X.LP
  1796. X.ft B
  1797. X.nf
  1798. X.sp .5
  1799. xdr_authunix_parms(xdrs, aupp)
  1800. \s-1XDR\s0 *xdrs;
  1801. struct authunix_parms *aupp;
  1802. X.fi
  1803. X.ft R
  1804. X.IP
  1805. Used for describing
  1806. X.SM UNIX
  1807. credentials, externally. This routine is useful for users
  1808. who wish to generate these credentials without using the
  1809. X.SM RPC
  1810. authentication package.
  1811. X.br
  1812. X.if t .ne 7
  1813. X.LP
  1814. X.ft B
  1815. X.nf
  1816. X.sp .5
  1817. void
  1818. xdr_callhdr(xdrs, chdr)
  1819. \s-1XDR\s0 *xdrs;
  1820. struct rpc_msg *chdr;
  1821. X.fi
  1822. X.ft R
  1823. X.IP
  1824. Used for describing
  1825. X.SM RPC
  1826. messages, externally.
  1827. This routine is useful for users who wish to generate
  1828. X.SM RPC\s0-style
  1829. messages without using the
  1830. X.SM RPC
  1831. package.
  1832. X.br
  1833. X.if t .ne 7
  1834. X.LP
  1835. X.ft B
  1836. X.nf
  1837. X.sp .5
  1838. xdr_callmsg(xdrs, cmsg)
  1839. \s-1XDR\s0 *xdrs;
  1840. struct rpc_msg *cmsg;
  1841. X.fi
  1842. X.ft R
  1843. X.IP
  1844. Used for describing
  1845. X.SM RPC
  1846. messages, externally.
  1847. This routine is useful for users who wish to generate
  1848. X.SM RPC\s0-style
  1849. messages without using the
  1850. X.SM RPC
  1851. package.
  1852. X.br
  1853. X.if t .ne 7
  1854. X.LP
  1855. X.ft B
  1856. X.nf
  1857. X.sp .5
  1858. xdr_opaque_auth(xdrs, ap)
  1859. \s-1XDR\s0 *xdrs;
  1860. struct opaque_auth *ap;
  1861. X.fi
  1862. X.ft R
  1863. X.IP
  1864. Used for describing
  1865. X.SM RPC
  1866. messages, externally.
  1867. This routine is useful for users who wish to generate
  1868. X.SM RPC\s0-style
  1869. messages without using the
  1870. X.SM RPC
  1871. package.
  1872. X.br
  1873. X.if t .ne 7
  1874. X.LP
  1875. X.ft B
  1876. X.nf
  1877. X.sp .5
  1878. xdr_pmap(xdrs, regs)
  1879. \s-1XDR\s0 *xdrs;
  1880. struct pmap *regs;
  1881. X.fi
  1882. X.ft R
  1883. X.IP
  1884. Used for describing parameters to various
  1885. X.B portmap
  1886. procedures, externally.
  1887. This routine is useful for users who wish to generate
  1888. these parameters without using the
  1889. X.B pmap
  1890. interface.
  1891. X.br
  1892. X.if t .ne 7
  1893. X.LP
  1894. X.ft B
  1895. X.nf
  1896. X.sp .5
  1897. xdr_pmaplist(xdrs, rp)
  1898. \s-1XDR\s0 *xdrs;
  1899. struct pmaplist **rp;
  1900. X.fi
  1901. X.ft R
  1902. X.IP
  1903. Used for describing a list of port mappings, externally.
  1904. This routine is useful for users who wish to generate
  1905. these parameters without using the
  1906. X.B pmap
  1907. interface.
  1908. X.br
  1909. X.if t .ne 7
  1910. X.LP
  1911. X.ft B
  1912. X.nf
  1913. X.sp .5
  1914. xdr_rejected_reply(xdrs, rr)
  1915. \s-1XDR\s0 *xdrs;
  1916. struct rejected_reply *rr;
  1917. X.fi
  1918. X.ft R
  1919. X.IP
  1920. Used for describing
  1921. X.SM RPC
  1922. messages, externally.
  1923. This routine is useful for users who wish to generate
  1924. X.SM RPC\s0-style
  1925. messages without using the
  1926. X.SM RPC
  1927. package.
  1928. X.br
  1929. X.if t .ne 8
  1930. X.LP
  1931. X.ft B
  1932. X.nf
  1933. X.sp .5
  1934. xdr_replymsg(xdrs, rmsg)
  1935. \s-1XDR\s0 *xdrs;
  1936. struct rpc_msg *rmsg;
  1937. X.fi
  1938. X.ft R
  1939. X.IP
  1940. Used for describing
  1941. X.SM RPC
  1942. messages, externally.
  1943. This routine is useful for users who wish to generate
  1944. X.SM RPC
  1945. style messages without using the
  1946. X.SM RPC
  1947. package.
  1948. X.br
  1949. X.if t .ne 8
  1950. X.LP
  1951. X.ft B
  1952. X.nf
  1953. X.sp .5
  1954. void
  1955. xprt_register(xprt)
  1956. \s-1SVCXPRT\s0 *xprt;
  1957. X.fi
  1958. X.ft R
  1959. X.IP
  1960. After
  1961. X.SM RPC
  1962. service transport handles are created,
  1963. they should register themselves with the
  1964. X.SM RPC
  1965. service package.
  1966. This routine modifies the global variable
  1967. X.BR svc_fds .
  1968. Service implementors usually don't need this routine.
  1969. X.br
  1970. X.if t .ne 8
  1971. X.LP
  1972. X.ft B
  1973. X.nf
  1974. X.sp .5
  1975. void
  1976. xprt_unregister(xprt)
  1977. \s-1SVCXPRT\s0 *xprt;
  1978. X.fi
  1979. X.ft R
  1980. X.IP
  1981. Before an
  1982. X.SM RPC
  1983. service transport handle is destroyed,
  1984. it should unregister itself with the
  1985. X.SM RPC
  1986. service package.
  1987. This routine modifies the global variable
  1988. X.BR svc_fds .
  1989. Service implementors usually don't need this routine.
  1990. X.SH SEE ALSO
  1991. X.BR \s-1XDR\s0 (3N)
  1992. X.br
  1993. The following manuals:
  1994. X.RS
  1995. X.ft I
  1996. Remote Procedure Calls: Protocol Specification
  1997. X.br
  1998. Remote Procedure Call Programming Guide
  1999. X.br
  2000. rpcgen Programming Guide
  2001. X.br
  2002. X.ft R
  2003. X.RE
  2004.  
  2005. Funky_Stuff
  2006. len=`wc -c < rpc.3n`
  2007. if [ $len !=    28619 ] ; then
  2008.   echo error: rpc.3n was $len bytes long, should have been    28619
  2009. fi
  2010. echo x - xdr.3n
  2011. sed -e 's/^X//' > xdr.3n <<'Funky_Stuff'
  2012. X.\" @(#)xdr.3n    1.1 87/11/04 3.9 RPCSRC
  2013. X.TH XDR 3N "3 November 1987"
  2014. X.SH NAME
  2015. xdr \- library routines for external data representation
  2016. X.SH SYNOPSIS AND DESCRIPTION
  2017. These routines allow C programmers to describe
  2018. arbitrary data structures in a machine-independent fashion.
  2019. Data for remote procedure calls are transmitted using these
  2020. routines.
  2021. X.LP
  2022. X.ft B
  2023. X.nf
  2024. X.sp .5
  2025. xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
  2026. \s-1XDR\s0 *xdrs;
  2027. char **arrp;
  2028. u_int *sizep, maxsize, elsize;
  2029. xdrproc_t elproc;
  2030. X.fi
  2031. X.ft R
  2032. X.IP
  2033. A filter primitive that translates between variable-length
  2034. arrays
  2035. and their corresponding external representations. The
  2036. parameter
  2037. X.B arrp
  2038. is the address of the pointer to the array, while
  2039. X.B sizep
  2040. is the address of the element count of the array;
  2041. this element count cannot exceed
  2042. X.BR maxsize .
  2043. The parameter
  2044. X.B elsize
  2045. is the
  2046. X.B sizeof
  2047. each of the array's elements, and
  2048. X.B elproc
  2049. is an
  2050. X.SM XDR
  2051. filter that translates between
  2052. the array elements' C form, and their external
  2053. representation.
  2054. This routine returns one if it succeeds, zero otherwise.
  2055. X.br
  2056. X.if t .ne 8
  2057. X.LP
  2058. X.ft B
  2059. X.nf
  2060. X.sp .5
  2061. xdr_bool(xdrs, bp)
  2062. \s-1XDR\s0 *xdrs;
  2063. bool_t *bp;
  2064. X.fi
  2065. X.ft R
  2066. X.IP
  2067. A filter primitive that translates between booleans (C
  2068. integers)
  2069. and their external representations. When encoding data, this
  2070. filter produces values of either one or zero.
  2071. This routine returns one if it succeeds, zero otherwise.
  2072. X.br
  2073. X.if t .ne 10
  2074. X.LP
  2075. X.ft B
  2076. X.nf
  2077. X.sp .5
  2078. xdr_bytes(xdrs, sp, sizep, maxsize)
  2079. \s-1XDR\s0 *xdrs;
  2080. char **sp;
  2081. u_int *sizep, maxsize;
  2082. X.fi
  2083. X.ft R
  2084. X.IP
  2085. A filter primitive that translates between counted byte
  2086. strings and their external representations.
  2087. The parameter
  2088. X.B sp
  2089. is the address of the string pointer. The length of the
  2090. string is located at address
  2091. X.BR sizep ;
  2092. strings cannot be longer than
  2093. X.BR maxsize .
  2094. This routine returns one if it succeeds, zero otherwise.
  2095. X.br
  2096. X.if t .ne 7
  2097. X.LP
  2098. X.ft B
  2099. X.nf
  2100. X.sp .5
  2101. xdr_char(xdrs, cp)
  2102. \s-1XDR\s0 *xdrs;
  2103. char *cp;
  2104. X.fi
  2105. X.ft R
  2106. X.IP
  2107. A filter primitive that translates between C characters
  2108. and their external representations.
  2109. This routine returns one if it succeeds, zero otherwise.
  2110. Note: encoded characters are not packed, and occupy 4 bytes
  2111. each. For arrays of characters, it is worthwhile to
  2112. consider
  2113. X.BR xdr_bytes ,
  2114. X.BR xdr_opaque or
  2115. X.BR xdr_string .
  2116. X.br
  2117. X.if t .ne 8
  2118. X.LP
  2119. X.ft B
  2120. X.nf
  2121. X.sp .5
  2122. void
  2123. xdr_destroy(xdrs)
  2124. \s-1XDR\s0 *xdrs;
  2125. X.fi
  2126. X.ft R
  2127. X.IP
  2128. A macro that invokes the destroy routine associated with the
  2129. X.SM XDR
  2130. stream,
  2131. X.BR xdrs .
  2132. Destruction usually involves freeing private data structures
  2133. associated with the stream.  Using
  2134. X.B xdrs
  2135. after invoking
  2136. X.B xdr_destroy
  2137. is undefined.
  2138. X.br
  2139. X.if t .ne 7
  2140. X.LP
  2141. X.ft B
  2142. X.nf
  2143. X.sp .5
  2144. xdr_double(xdrs, dp)
  2145. \s-1XDR\s0 *xdrs;
  2146. double *dp;
  2147. X.fi
  2148. X.ft R
  2149. X.IP
  2150. A filter primitive that translates between C
  2151. X.B double
  2152. precision numbers and their external representations.
  2153. This routine returns one if it succeeds, zero otherwise.
  2154. X.br
  2155. X.if t .ne 7
  2156. X.LP
  2157. X.ft B
  2158. X.nf
  2159. X.sp .5
  2160. xdr_enum(xdrs, ep)
  2161. \s-1XDR\s0 *xdrs;
  2162. enum_t *ep;
  2163. X.fi
  2164. X.ft R
  2165. X.IP
  2166. A filter primitive that translates between C
  2167. X.BR enum s
  2168. (actually integers) and their external representations.
  2169. This routine returns one if it succeeds, zero otherwise.
  2170. X.br
  2171. X.if t .ne 8
  2172. X.LP
  2173. X.ft B
  2174. X.nf
  2175. X.sp .5
  2176. xdr_float(xdrs, fp)
  2177. \s-1XDR\s0 *xdrs;
  2178. float *fp;
  2179. X.fi
  2180. X.ft R
  2181. X.IP
  2182. A filter primitive that translates between C
  2183. X.BR float s
  2184. and their external representations.
  2185. This routine returns one if it succeeds, zero otherwise.
  2186. X.br
  2187. X.if t .ne 9
  2188. X.LP
  2189. X.ft B
  2190. X.nf
  2191. X.sp .5
  2192. void
  2193. xdr_free(proc, objp)
  2194. xdrproc_t proc;
  2195. char *objp;
  2196. X.fi
  2197. X.ft R
  2198. X.IP
  2199. Generic freeing routine. The first argument is the
  2200. X.SM XDR
  2201. routine for the object being freed. The second argument
  2202. is a pointer to the object itself. Note: the pointer passed
  2203. to this routine is
  2204. X.I not
  2205. freed, but what it points to
  2206. X.I is
  2207. freed (recursively).
  2208. X.br
  2209. X.if t .ne 8
  2210. X.LP
  2211. X.ft B
  2212. X.nf
  2213. X.sp .5
  2214. u_int
  2215. xdr_getpos(xdrs)
  2216. \s-1XDR\s0 *xdrs;
  2217. X.fi
  2218. X.ft R
  2219. X.IP
  2220. A macro that invokes the get-position routine
  2221. associated with the
  2222. X.SM XDR
  2223. stream,
  2224. X.BR xdrs .
  2225. The routine returns an unsigned integer,
  2226. which indicates the position of the
  2227. X.SM XDR
  2228. byte stream.
  2229. A desirable feature of
  2230. X.SM XDR
  2231. streams
  2232. is that simple arithmetic works with this number,
  2233. although the
  2234. X.SM XDR
  2235. stream instances need not guarantee this.
  2236. X.br
  2237. X.if t .ne 4
  2238. X.LP
  2239. X.ft B
  2240. X.nf
  2241. X.sp .5
  2242. X.br
  2243. long *
  2244. xdr_inline(xdrs, len)
  2245. \s-1XDR\s0 *xdrs;
  2246. int len;
  2247. X.fi
  2248. X.ft R
  2249. X.IP
  2250. A macro that invokes the in-line routine associated with the
  2251. X.SM XDR
  2252. stream,
  2253. X.BR xdrs .
  2254. The routine returns a pointer
  2255. to a contiguous piece of the stream's buffer;
  2256. X.B len
  2257. is the byte length of the desired buffer.
  2258. Note that pointer is cast to
  2259. X.BR "long *" .
  2260. X.IP
  2261. Warning:
  2262. X.B xdr_inline
  2263. may return
  2264. X.SM NULL
  2265. (0) if it cannot allocate a contiguous piece of a buffer.
  2266. Therefore the behavior may vary among stream instances;
  2267. it exists for the sake of efficiency.
  2268. X.br
  2269. X.if t .ne 7
  2270. X.LP
  2271. X.ft B
  2272. X.nf
  2273. X.sp .5
  2274. xdr_int(xdrs, ip)
  2275. \s-1XDR\s0 *xdrs;
  2276. int *ip;
  2277. X.fi
  2278. X.ft R
  2279. X.IP
  2280. A filter primitive that translates between C integers
  2281. and their external representations.
  2282. This routine returns one if it succeeds, zero otherwise.
  2283. X.br
  2284. X.if t .ne 7
  2285. X.LP
  2286. X.ft B
  2287. X.nf
  2288. X.sp .5
  2289. xdr_long(xdrs, lp)
  2290. \s-1XDR\s0 *xdrs;
  2291. long *lp;
  2292. X.fi
  2293. X.ft R
  2294. X.IP
  2295. A filter primitive that translates between C
  2296. X.B long
  2297. integers and their external representations.
  2298. This routine returns one if it succeeds, zero otherwise.
  2299. X.br
  2300. X.if t .ne 12
  2301. X.LP
  2302. X.ft B
  2303. X.nf
  2304. X.sp .5
  2305. void
  2306. xdrmem_create(xdrs, addr, size, op)
  2307. \s-1XDR\s0 *xdrs;
  2308. char *addr;
  2309. u_int size;
  2310. enum xdr_op op;
  2311. X.fi
  2312. X.ft R
  2313. X.IP
  2314. This routine initializes the
  2315. X.SM XDR
  2316. stream object pointed to by
  2317. X.BR xdrs .
  2318. The stream's data is written to, or read from,
  2319. a chunk of memory at location
  2320. X.B addr
  2321. whose length is no more than
  2322. X.B size
  2323. bytes long.  The
  2324. X.B op
  2325. determines the direction of the
  2326. X.SM XDR
  2327. stream
  2328. (either
  2329. X.BR \s-1XDR_ENCODE\s0 ,
  2330. X.BR \s-1XDR_DECODE\s0 ,
  2331. or
  2332. X.B
  2333. X.SM XDR_FREE
  2334. ).
  2335. X.br
  2336. X.if t .ne 10
  2337. X.LP
  2338. X.ft B
  2339. X.nf
  2340. X.sp .5
  2341. xdr_opaque(xdrs, cp, cnt)
  2342. \s-1XDR\s0 *xdrs;
  2343. char *cp;
  2344. u_int cnt;
  2345. X.fi
  2346. X.ft R
  2347. X.IP
  2348. A filter primitive that translates between fixed size opaque
  2349. data
  2350. and its external representation.
  2351. The parameter
  2352. X.B cp
  2353. is the address of the opaque object, and
  2354. X.B cnt
  2355. is its size in bytes.
  2356. This routine returns one if it succeeds, zero otherwise.
  2357. X.br
  2358. X.if t .ne 10
  2359. X.LP
  2360. X.ft B
  2361. X.nf
  2362. X.sp .5
  2363. xdr_pointer(xdrs, objpp, objsize, xdrobj)
  2364. \s-1XDR\s0 *xdrs;
  2365. char **objpp;
  2366. u_int objsize;
  2367. xdrproc_t xdrobj;
  2368. X.fi
  2369. X.ft R
  2370. X.IP
  2371. Like
  2372. X.B xdr_reference
  2373. in that it
  2374. X.SM XDR
  2375. 's pointers, but the difference is that
  2376. X.B xdr_pointer
  2377. serializes
  2378. X.SM NULL
  2379. pointers, whereas
  2380. X.B xdr_reference
  2381. does not. Thus
  2382. X.B xdr_pointer
  2383. can
  2384. X.SM XDR
  2385. recursive data structures, such as binary trees or
  2386. linked lists, correctly, whereas
  2387. X.B xdr_reference
  2388. will fail.
  2389. X.br
  2390. X.if t .ne 15
  2391. X.LP
  2392. X.ft B
  2393. X.nf
  2394. X.sp .5
  2395. void
  2396. xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit)
  2397. \s-1XDR\s0 *xdrs;
  2398. u_int sendsize, recvsize;
  2399. char *handle;
  2400. int (*readit)(), (*writeit)();
  2401. X.fi
  2402. X.ft R
  2403. X.IP
  2404. This routine initializes the
  2405. X.SM XDR
  2406. stream object pointed to by
  2407. X.BR xdrs .
  2408. The stream's data is written to a buffer of size
  2409. X.BR sendsize ;
  2410. a value of zero indicates the system should use a suitable
  2411. default. The stream's data is read from a buffer of size
  2412. X.BR recvsize ;
  2413. it too can be set to a suitable default by passing a zero
  2414. value.
  2415. When a stream's output buffer is full,
  2416. X.B writeit
  2417. is called.  Similarly, when a stream's input buffer is empty,
  2418. X.B readit
  2419. is called.  The behavior of these two routines is similar to
  2420. the
  2421. X.SM UNIX
  2422. system calls
  2423. X.B read
  2424. and
  2425. X.BR write ,
  2426. except that
  2427. X.B handle
  2428. is passed to the former routines as the first parameter.
  2429. Note that the
  2430. X.SM XDR
  2431. stream's
  2432. X.B op
  2433. field must be set by the caller.
  2434. X.IP
  2435. Warning: this
  2436. X.SM XDR
  2437. stream implements an intermediate record stream.
  2438. Therefore there are additional bytes in the stream
  2439. to provide record boundary information.
  2440. X.br
  2441. X.if t .ne 9
  2442. X.LP
  2443. X.ft B
  2444. X.nf
  2445. X.sp .5
  2446. xdrrec_endofrecord(xdrs, sendnow)
  2447. \s-1XDR\s0 *xdrs;
  2448. int sendnow;
  2449. X.fi
  2450. X.ft R
  2451. X.IP
  2452. This routine can be invoked only on streams created by
  2453. X.BR xdrrec_create .
  2454. The data in the output buffer is marked as a completed
  2455. record,
  2456. and the output buffer is optionally written out if
  2457. X.B sendnow
  2458. is non-zero. This routine returns one if it succeeds, zero
  2459. otherwise.
  2460. X.br
  2461. X.if t .ne 8
  2462. X.LP
  2463. X.ft B
  2464. X.nf
  2465. X.sp .5
  2466. xdrrec_eof(xdrs)
  2467. \s-1XDR\s0 *xdrs;
  2468. int empty;
  2469. X.fi
  2470. X.ft R
  2471. X.IP
  2472. This routine can be invoked only on streams created by
  2473. X.BR xdrrec_create .
  2474. After consuming the rest of the current record in the stream,
  2475. this routine returns one if the stream has no more input,
  2476. zero otherwise.
  2477. X.br
  2478. X.if t .ne 3
  2479. X.LP
  2480. X.ft B
  2481. X.nf
  2482. X.sp .5
  2483. xdrrec_skiprecord(xdrs)
  2484. \s-1XDR\s0 *xdrs;
  2485. X.fi
  2486. X.ft R
  2487. X.IP
  2488. This routine can be invoked only on streams created by
  2489. X.BR xdrrec_create .
  2490. It tells the
  2491. X.SM XDR
  2492. implementation that the rest of the current record
  2493. in the stream's input buffer should be discarded.
  2494. This routine returns one if it succeeds, zero otherwise.
  2495. X.br
  2496. X.if t .ne 11
  2497. X.LP
  2498. X.ft B
  2499. X.nf
  2500. X.sp .5
  2501. xdr_reference(xdrs, pp, size, proc)
  2502. \s-1XDR\s0 *xdrs;
  2503. char **pp;
  2504. u_int size;
  2505. xdrproc_t proc;
  2506. X.fi
  2507. X.ft R
  2508. X.IP
  2509. A primitive that provides pointer chasing within structures.
  2510. The parameter
  2511. X.B pp
  2512. is the address of the pointer;
  2513. X.B size
  2514. is the
  2515. X.B sizeof
  2516. the structure that
  2517. X.B *pp
  2518. points to; and
  2519. X.B proc
  2520. is an
  2521. X.SM XDR
  2522. procedure that filters the structure
  2523. between its C form and its external representation.
  2524. This routine returns one if it succeeds, zero otherwise.
  2525. X.IP
  2526. Warning: this routine does not understand
  2527. X.SM NULL
  2528. pointers. Use
  2529. X.B xdr_pointer
  2530. instead.
  2531. X.br
  2532. X.if t .ne 10
  2533. X.LP
  2534. X.ft B
  2535. X.nf
  2536. X.sp .5
  2537. X.br
  2538. X.if t .ne 9
  2539. X.LP
  2540. X.ft B
  2541. X.nf
  2542. X.sp .5
  2543. xdr_setpos(xdrs, pos)
  2544. \s-1XDR\s0 *xdrs;
  2545. u_int pos;
  2546. X.fi
  2547. X.ft R
  2548. X.IP
  2549. A macro that invokes the set position routine associated with
  2550. the
  2551. X.SM XDR
  2552. stream
  2553. X.BR xdrs .
  2554. The parameter
  2555. X.B pos
  2556. is a position value obtained from
  2557. X.BR xdr_getpos .
  2558. This routine returns one if the
  2559. X.SM XDR
  2560. stream could be repositioned,
  2561. and zero otherwise.
  2562. X.IP
  2563. Warning: it is difficult to reposition some types of
  2564. X.SM XDR
  2565. streams,
  2566. so this routine may fail with one type of stream and succeed
  2567. with
  2568. another.
  2569. X.br
  2570. X.if t .ne 8
  2571. X.LP
  2572. X.ft B
  2573. X.nf
  2574. X.sp .5
  2575. xdr_short(xdrs, sp)
  2576. \s-1XDR\s0 *xdrs;
  2577. short *sp;
  2578. X.fi
  2579. X.ft R
  2580. X.IP
  2581. A filter primitive that translates between C
  2582. X.B short
  2583. integers and their external representations.
  2584. This routine returns one if it succeeds, zero otherwise.
  2585. X.br
  2586. X.if t .ne 10
  2587. X.LP
  2588. X.ft B
  2589. X.nf
  2590. X.sp .5
  2591. void
  2592. xdrstdio_create(xdrs, file, op)
  2593. \s-1XDR\s0 *xdrs;
  2594. FILE *file;
  2595. enum xdr_op op;
  2596. X.fi
  2597. X.ft R
  2598. X.IP
  2599. This routine initializes the
  2600. X.SM XDR
  2601. stream object pointed to by
  2602. X.BR xdrs .
  2603. The
  2604. X.SM XDR
  2605. stream data is written to, or read from, the Standard
  2606. X.B I/O
  2607. stream
  2608. X.BR file .
  2609. The parameter
  2610. X.B op
  2611. determines the direction of the
  2612. X.SM XDR
  2613. stream (either
  2614. X.B
  2615. X.SM XDR_ENCODE
  2616. ,
  2617. X.B
  2618. X.SM XDR_DECODE
  2619. ,
  2620. or
  2621. X.B
  2622. X.SM XDR_FREE
  2623. ).
  2624. X.IP
  2625. Warning: the destroy routine associated with such
  2626. X.SM XDR
  2627. streams calls
  2628. X.B fflush
  2629. on the
  2630. X.B file
  2631. stream, but never
  2632. X.BR fclose .
  2633. X.br
  2634. X.if t .ne 9
  2635. X.LP
  2636. X.ft B
  2637. X.nf
  2638. X.sp .5
  2639. xdr_string(xdrs, sp, maxsize)
  2640. \s-1XDR\s0 *xdrs;
  2641. char **sp;
  2642. u_int maxsize;
  2643. X.fi
  2644. X.ft R
  2645. X.IP
  2646. A filter primitive that translates between C strings and
  2647. their
  2648. corresponding external representations.
  2649. Strings cannot be longer than
  2650. X.BR maxsize .
  2651. Note that
  2652. X.B sp
  2653. is the address of the string's pointer.
  2654. This routine returns one if it succeeds, zero otherwise.
  2655. X.br
  2656. X.if t .ne 8
  2657. X.LP
  2658. X.ft B
  2659. X.nf
  2660. X.sp .5
  2661. xdr_u_char(xdrs, ucp)
  2662. \s-1XDR\s0 *xdrs;
  2663. unsigned char *ucp;
  2664. X.fi
  2665. X.ft R
  2666. X.IP
  2667. A filter primitive that translates between
  2668. X.B unsigned
  2669. C characters and their external representations.
  2670. This routine returns one if it succeeds, zero otherwise.
  2671. X.br
  2672. X.if t .ne 9
  2673. X.LP
  2674. X.ft B
  2675. X.nf
  2676. X.sp .5
  2677. xdr_u_int(xdrs, up)
  2678. \s-1XDR\s0 *xdrs;
  2679. unsigned *up;
  2680. X.fi
  2681. X.ft R
  2682. X.IP
  2683. A filter primitive that translates between C
  2684. X.B unsigned
  2685. integers and their external representations.
  2686. This routine returns one if it succeeds, zero otherwise.
  2687. X.br
  2688. X.if t .ne 7
  2689. X.LP
  2690. X.ft B
  2691. X.nf
  2692. X.sp .5
  2693. xdr_u_long(xdrs, ulp)
  2694. \s-1XDR\s0 *xdrs;
  2695. unsigned long *ulp;
  2696. X.fi
  2697. X.ft R
  2698. X.IP
  2699. A filter primitive that translates between C
  2700. X.B "unsigned long"
  2701. integers and their external representations.
  2702. This routine returns one if it succeeds, zero otherwise.
  2703. X.br
  2704. X.if t .ne 7
  2705. X.LP
  2706. X.ft B
  2707. X.nf
  2708. X.sp .5
  2709. xdr_u_short(xdrs, usp)
  2710. \s-1XDR\s0 *xdrs;
  2711. unsigned short *usp;
  2712. X.fi
  2713. X.ft R
  2714. X.IP
  2715. A filter primitive that translates between C
  2716. X.B "unsigned short"
  2717. integers and their external representations.
  2718. This routine returns one if it succeeds, zero otherwise.
  2719. X.br
  2720. X.if t .ne 16
  2721. X.LP
  2722. X.ft B
  2723. X.nf
  2724. X.sp .5
  2725. xdr_union(xdrs, dscmp, unp, choices, dfault)
  2726. \s-1XDR\s0 *xdrs;
  2727. int *dscmp;
  2728. char *unp;
  2729. struct xdr_discrim *choices;
  2730. bool_t (*defaultarm)();  /* may equal \s-1NULL\s0 */
  2731. X.fi
  2732. X.ft R
  2733. X.IP
  2734. A filter primitive that translates between a discriminated C
  2735. X.B union
  2736. and its corresponding external representation. It first
  2737. translates the discriminant of the union located at
  2738. X.BR dscmp .
  2739. This discriminant is always an
  2740. X.BR enum_t .
  2741. Next the union located at
  2742. X.B unp
  2743. is translated.  The parameter
  2744. X.B choices
  2745. is a pointer to an array of
  2746. X.B xdr_discrim
  2747. structures. Each structure contains an ordered pair of
  2748. X.BR "[value, proc]" .
  2749. If the union's discriminant is equal to the associated
  2750. X.BR value ,
  2751. then the
  2752. X.B proc
  2753. is called to translate the union.  The end of the
  2754. X.B xdr_discrim
  2755. structure array is denoted by a routine of value
  2756. X.SM NULL .
  2757. If the discriminant is not found in the
  2758. X.B choices
  2759. array, then the
  2760. X.B defaultarm
  2761. procedure is called (if it's not
  2762. X.SM NULL
  2763. ).
  2764. Returns one if it succeeds, zero otherwise.
  2765. X.br
  2766. X.if t .ne 6
  2767. X.LP
  2768. X.ft B
  2769. X.nf
  2770. X.sp .5
  2771. xdr_vector(xdrs, arrp, size, elsize, elproc)
  2772. \s-1XDR\s0 *xdrs;
  2773. char *arrp;
  2774. u_int size, elsize;
  2775. xdrproc_t elproc;
  2776. X.fi
  2777. X.ft R
  2778. X.IP
  2779. A filter primitive that translates between fixed-length
  2780. arrays
  2781. and their corresponding external representations.  The
  2782. parameter
  2783. X.B arrp
  2784. is the address of the pointer to the array, while
  2785. X.B size
  2786. is is the element count of the array.  The parameter
  2787. X.B elsize
  2788. is the
  2789. X.B sizeof
  2790. each of the array's elements, and
  2791. X.B elproc
  2792. is an
  2793. X.SM XDR
  2794. filter that translates between
  2795. the array elements' C form, and their external
  2796. representation.
  2797. This routine returns one if it succeeds, zero otherwise.
  2798. X.br
  2799. X.if t .ne 5
  2800. X.LP
  2801. X.ft B
  2802. X.nf
  2803. X.sp .5
  2804. xdr_void()
  2805. X.fi
  2806. X.ft R
  2807. X.IP
  2808. This routine always returns one.
  2809. It may be passed to
  2810. X.SM RPC
  2811. routines that require a function parameter,
  2812. where nothing is to be done.
  2813. X.br
  2814. X.if t .ne 10
  2815. X.LP
  2816. X.ft B
  2817. X.nf
  2818. X.sp .5
  2819. xdr_wrapstring(xdrs, sp)
  2820. \s-1XDR\s0 *xdrs;
  2821. char **sp;
  2822. X.fi
  2823. X.ft R
  2824. X.IP
  2825. A primitive that calls
  2826. X.B "xdr_string(xdrs, sp, "
  2827. X.B
  2828. X.SM MAXUN.UNSIGNED
  2829. );
  2830. where
  2831. X.B
  2832. X.SM MAXUN.UNSIGNED
  2833. is the maximum value of an unsigned integer.
  2834. X.B xdr_wrapstring
  2835. is handy because the
  2836. X.SM RPC
  2837. package passes a maximum of two
  2838. X.SM XDR
  2839. routines as parameters, and
  2840. X.BR xdr_string ,
  2841. one of the most frequently used primitives, requires three.
  2842. Returns one if it succeeds, zero otherwise.
  2843. X.SH SEE ALSO
  2844. X.BR \s-1RPC\s0 (3N)
  2845. X.br
  2846. The followin manuals:
  2847. X.RS
  2848. X.ft I
  2849. eXternal Data Representation Standard: Protocol Specification
  2850. X.br
  2851. eXternal Data Representation: Sun Technical Notes
  2852. X.ft R
  2853. X.br
  2854. X.IR "\s-1XDR\s0: External Data Representation Standard" ,
  2855. X.SM RFC1014, Sun Microsystems, Inc.,
  2856. X.SM USC-ISI\s0.
  2857. Funky_Stuff
  2858. len=`wc -c < xdr.3n`
  2859. if [ $len !=    14790 ] ; then
  2860.   echo error: xdr.3n was $len bytes long, should have been    14790
  2861. fi
  2862. cd ..
  2863. echo done with directory man3
  2864. echo x - man5
  2865. echo creating directory man5
  2866. mkdir man5
  2867. cd man5
  2868. echo x - rpc.5
  2869. sed -e 's/^X//' > rpc.5 <<'Funky_Stuff'
  2870. X.\" @(#)rpc.5    1.3 87/12/02 3.9 RPCSRC
  2871. X.\" @(#)rpc.5 1.4 87/11/27 SMI;
  2872. X.TH RPC 5  "26 September 1985"
  2873. X.SH NAME
  2874. rpc \- rpc program number data base
  2875. X.SH SYNOPSIS
  2876. X.B /etc/rpc
  2877. X.SH DESCRIPTION
  2878. X.IX  "rpc program number file"  ""  "\fLrpc\fP \(em rpc name data base"
  2879. The
  2880. X.I rpc
  2881. file contains user readable names that
  2882. can be used in place of rpc program numbers.
  2883. Each line has the following information:
  2884. X.HP 10
  2885. name of server for the rpc program
  2886. X.br
  2887. X.ns
  2888. X.HP 10
  2889. rpc program number
  2890. X.br
  2891. X.ns
  2892. X.HP 10
  2893. aliases
  2894. X.LP
  2895. Items are separated by any number of blanks and/or
  2896. tab characters.
  2897. A ``#'' indicates the beginning of a comment; characters up to the end of
  2898. the line are not interpreted by routines which search the file.
  2899. X.LP
  2900. Here is an example of the \fI/etc/rpc\fP file from the Sun RPC Source
  2901. distribution.
  2902. X.nf
  2903. X.ta 1.0i +1.0i +1.0i +1.0i
  2904. #
  2905. # rpc 87/12/02 3.9 RPCSRC
  2906. #
  2907. portmapper    100000    portmap sunrpc
  2908. rstat_svc        100001    rstatd rstat rup perfmeter
  2909. rusersd        100002    rusers
  2910. nfs        100003    nfsprog
  2911. ypserv        100004    ypprog
  2912. mountd        100005    mount showmount
  2913. ypbind        100007
  2914. walld        100008    rwall shutdown
  2915. yppasswdd    100009    yppasswd
  2916. etherstatd    100010    etherstat
  2917. rquotad        100011    rquotaprog quota rquota
  2918. sprayd        100012    spray
  2919. 3270_mapper    100013
  2920. rje_mapper    100014
  2921. selection_svc    100015    selnsvc
  2922. database_svc    100016
  2923. rexd        100017    rex
  2924. alis        100018
  2925. sched        100019
  2926. llockmgr    100020
  2927. nlockmgr    100021
  2928. x25.inr        100022
  2929. statmon        100023
  2930. status        100024
  2931. bootparam    100026
  2932. ypupdated    100028    ypupdate
  2933. keyserv        100029    keyserver
  2934. X.fi
  2935. X.DT
  2936. X.SH FILES
  2937. /etc/rpc
  2938. X.SH "SEE ALSO"
  2939. getrpcent(3N)
  2940. Funky_Stuff
  2941. len=`wc -c < rpc.5`
  2942. if [ $len !=     1519 ] ; then
  2943.   echo error: rpc.5 was $len bytes long, should have been     1519
  2944. fi
  2945. cd ..
  2946. echo done with directory man5
  2947. echo x - man8
  2948. echo creating directory man8
  2949. mkdir man8
  2950. cd man8
  2951. echo x - portmap.8c
  2952. sed -e 's/^X//' > portmap.8c <<'Funky_Stuff'
  2953. X.\" @(#)portmap.8c    1.1 87/11/04 3.9 RPCSRC
  2954. X.TH PORTMAP 8C "9 September 1987"
  2955. X.SH NAME
  2956. portmap \- DARPA port to RPC program number mapper
  2957. X.SH SYNOPSIS
  2958. X.B /usr/etc/rpc.portmap
  2959. X.SH DESCRIPTION
  2960. X.IX  "portmap command"  ""  "\fLportmap\fP \(em DARPA to RPC mapper"
  2961. X.IX  DARPA "to RPC mapper \(em \fLportmap\fP"
  2962. X.B portmap
  2963. is a server that converts
  2964. X.SM RPC
  2965. program numbers into
  2966. X.SM DARPA
  2967. protocol port numbers.
  2968. It must be running in order to make
  2969. X.SM RPC
  2970. calls.
  2971. X.LP
  2972. When an
  2973. X.SM RPC
  2974. server is started, it will tell
  2975. X.B portmap
  2976. what port number it is listening to, and what
  2977. X.SM RPC
  2978. program numbers it is prepared to serve.
  2979. When a client wishes to make an
  2980. X.SM RPC
  2981. call to a given program number,
  2982. it will first contact
  2983. X.B portmap
  2984. on the server machine to determine
  2985. the port number where
  2986. X.SM RPC
  2987. packets should be sent.
  2988. X.LP
  2989. Normally, standard
  2990. X.SM RPC
  2991. servers are started by
  2992. X.BR inetd (8C),
  2993. so
  2994. X.B portmap
  2995. must be started before
  2996. X.B inetd
  2997. is invoked.
  2998. X.SH "SEE ALSO"
  2999. X.BR servers (5),
  3000. X.BR rpcinfo (8),
  3001. X.BR inetd (8)
  3002. X.SH BUGS
  3003. If
  3004. X.B portmap
  3005. crashes, all servers must be restarted.
  3006. Funky_Stuff
  3007. len=`wc -c < portmap.8c`
  3008. if [ $len !=     1061 ] ; then
  3009.   echo error: portmap.8c was $len bytes long, should have been     1061
  3010. fi
  3011. echo x - rpcinfo.8c
  3012. sed -e 's/^X//' > rpcinfo.8c <<'Funky_Stuff'
  3013. X.\" @(#)rpcinfo.8c    1.1 87/11/04 3.9 RPCSRC
  3014. X.TH RPCINFO 8C "3 November 1987"
  3015. X.SH NAME
  3016. rpcinfo \- report RPC information
  3017. X.SH SYNOPSIS
  3018. X.B "rpcinfo \-p"
  3019. [
  3020. X.I host
  3021. ]
  3022. X.LP
  3023. X.B "rpcinfo \-u"
  3024. X.I host
  3025. X.I program
  3026. [
  3027. X.I version
  3028. ]
  3029. X.LP
  3030. X.B "rpcinfo \-t"
  3031. X.I host
  3032. X.I program
  3033. [
  3034. X.I version
  3035. ]
  3036. X.LP
  3037. X.B "rpcinfo \-b"
  3038. X.I program
  3039. X.I version
  3040. X.SH DESCRIPTION
  3041. X.IX  "rpcinfo command"  ""  "\fLrpcinfo\fP \(em report RPC information"
  3042. X.IX RPC "report RPC information \(em \fLrpcinfo\fR"
  3043. X.B rpcinfo
  3044. makes an
  3045. X.SM RPC
  3046. call to an
  3047. X.SM RPC
  3048. server and reports what it finds.
  3049. X.SH OPTIONS
  3050. X.TP
  3051. X.B \-p
  3052. Probe the portmapper on
  3053. X.IR host ,
  3054. and print a list of all registered
  3055. X.SM RPC
  3056. programs.  If
  3057. X.I host
  3058. is not specified, it defaults to the value returned by
  3059. X.BR hostname (1).
  3060. X.TP
  3061. X.B \-u
  3062. Make an
  3063. X.SM RPC
  3064. call to procedure 0 of
  3065. X.I program
  3066. on the specified
  3067. X.I host
  3068. using
  3069. X.SM UDP\s0,
  3070. and report whether a response was received.
  3071. X.TP
  3072. X.B \-t
  3073. Make an
  3074. X.SM RPC
  3075. call to procedure 0 of
  3076. X.I program
  3077. on the specified
  3078. X.I host
  3079. using
  3080. X.SM TCP\s0,
  3081. and report whether a response was received.
  3082. X.TP
  3083. X.B \-b
  3084. Make an
  3085. X.SM RPC
  3086. broadcast to procedure 0 of the specified
  3087. X.I program
  3088. and
  3089. X.I version
  3090. using
  3091. X.SM UDP
  3092. and report all hosts that respond.
  3093. X.LP
  3094. The
  3095. X.I program
  3096. argument can be either a name or a number.
  3097. X.LP
  3098. If a
  3099. X.I version
  3100. is specified,
  3101. X.B rpcinfo
  3102. attempts to call that version of the specified
  3103. X.IR program .
  3104. Otherwise,
  3105. X.B rpcinfo
  3106. attempts to find all the registered version
  3107. numbers for the specified
  3108. X.I program
  3109. by calling version 0 (which is presumed not
  3110. to exist; if it does exist,
  3111. X.B rpcinfo
  3112. attempts to obtain this information by calling
  3113. an extremely high version
  3114. number instead) and attempts to call each registered version.
  3115. Note: the version number is required for the
  3116. X.B \-b
  3117. option.
  3118. X.SH EXAMPLES
  3119. To show all of the
  3120. X.SM RPC
  3121. services registered on the local machine use:
  3122. X.IP
  3123. X.B example% rpcinfo -p
  3124. X.LP
  3125. To show all of the
  3126. X.SM RPC
  3127. services registered on the machine named
  3128. X.B klaxon
  3129. use:
  3130. X.IP
  3131. X.B example% rpcinfo -p klaxon
  3132. X.LP
  3133. To show all machines on the local net that are running the Yellow Pages
  3134. service use:
  3135. X.IP
  3136. X.B "example% rpcinfo -b ypserv 'version' | uniq"
  3137. X.LP
  3138. where 'version' is the current Yellow Pages version obtained from the
  3139. results of the
  3140. X.B \-p
  3141. switch above.
  3142. X.SH "SEE ALSO"
  3143. X.BR rpc (5),
  3144. X.BR portmap (8C)
  3145. X.LP
  3146. X.I "\s-1RPC\s0 Programming Guide"
  3147. in
  3148. X.TX NETP
  3149. X.SH BUGS
  3150. In releases prior to Sun\s-1OS\s0
  3151. 3.0, the Network File System (\s-1NFS\s0) did not
  3152. register itself with the
  3153. portmapper;
  3154. X.B rpcinfo
  3155. cannot be used to make
  3156. X.SM RPC
  3157. calls to the
  3158. X.SM NFS
  3159. server on hosts running such releases.
  3160. Funky_Stuff
  3161. len=`wc -c < rpcinfo.8c`
  3162. if [ $len !=     2533 ] ; then
  3163.   echo error: rpcinfo.8c was $len bytes long, should have been     2533
  3164. fi
  3165. echo x - rstat_svc.8c
  3166. sed -e 's/^X//' > rstat_svc.8c <<'Funky_Stuff'
  3167. X.\" @(#)rstat_svc.8c    1.2 87/11/24 3.9 RPCSRC
  3168. X.\" @(#)rstatd.8c 1.10 87/09/09 SMI
  3169. X.TH RSTAT_SVC 8C "24 November 1987"
  3170. X.SH NAME
  3171. rstat_svc \- kernel statistics server
  3172. X.SH SYNOPSIS
  3173. X.B /etc/rstat_svc
  3174. X.SH DESCRIPTION
  3175. X.IX  "rstat_svc command"  ""  "\fLrstat_svc\fP \(em kernel statistics server"
  3176. X.IX  statistics  rstat_svc  ""  "\fLrstat_svc\fP \(em kernel statistics server"
  3177. X.IX  servers  rstat_svc  ""  "\fLrstat_svc\fP \(em kernel statistics server"
  3178. X.LP
  3179. X.B rstat_svc
  3180. is a server which returns performance statistics
  3181. obtained from the kernel.
  3182. These statistics are graphically displayed by the Sun Microsystems program,
  3183. X.BR perfmeter (1).
  3184. The
  3185. X.B rstat_svc
  3186. daemon is normally invoked at boot time through /etc/rc.local.
  3187. X.PP
  3188. X.B rstat_svc
  3189. uses an RPC protocol defined in /usr/include/rpcsvc/rstat.x.
  3190. Funky_Stuff
  3191. len=`wc -c < rstat_svc.8c`
  3192. if [ $len !=      791 ] ; then
  3193.   echo error: rstat_svc.8c was $len bytes long, should have been      791
  3194. fi
  3195. cd ..
  3196. echo done with directory man8
  3197. cd ..
  3198. echo done with directory man
  3199. exit
  3200.